Very interesting issue with regular expression Please Help Me :) - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: UFT / QTP Regular Expressions (https://www.learnqtp.com/forums/Forum-UFT-QTP-Regular-Expressions) +--- Thread: Very interesting issue with regular expression Please Help Me :) (/Thread-Very-interesting-issue-with-regular-expression-Please-Help-Me) |
Very interesting issue with regular expression Please Help Me :) - dzordz - 11-30-2012 Hello, I have big (for me) problem with QTP and VBS. I've tried to find problem solution but Google didn't help. My problem is: From string: "37596 AndrzejCzwarty ldskajf@porirker\.plUnlocked2012-11-30 37568 AndrzejDrugi ksjhgjhsdgfui@woeijf\.plLocked2012-11-30 37554 AndrzejPierwszy kdjsfhsjd@sdklj\.plLocked2012-11-30 37582 AndrzejTrzeci lsdhflkadjhf@lsdkf\.plUnlocked2012-11-30 " I want to take first value like "37554" which is after the word "Locked". Date in string is not always exist (or if exist, is changing), so it means that length is changing. Those numbers are random in every iteration. So, in above string my variable ought to equals 37554. Thank You for every help!! dzordz RE: Very interesting issue with regular expression Please Help Me :) - kordirko - 12-03-2012 Hi, try this code: Code: Dim strStr -exactly one space before the number, and exactly one space after the number. RE: Very interesting issue with regular expression Please Help Me :) - harishshenoy - 12-04-2012 If ur string with date: Code: a = "37596 AndrzejCzwarty ldskajf@porirker\.plUnlocked2012-11-30 37568 AndrzejDrugi ksjhgjhsdgfui@woeijf\.plLocked2012-11-30 37554 AndrzejPierwszy kdjsfhsjd@sdklj\.plLocked2012-11-30 37582 AndrzejTrzeci lsdhflkadjhf@lsdkf\.plUnlocked2012-11-30 " Output i got : 37554 If ur string without date: Code: a = "37596 AndrzejCzwarty ldskajf@porirker\.plUnlocked2012-11-30 37568 AndrzejDrugi ksjhgjhsdgfui@woeijf\.plLocked 37554 AndrzejPierwszy kdjsfhsjd@sdklj\.plLocked2012-11-30 37582 AndrzejTrzeci lsdhflkadjhf@lsdkf\.plUnlocked2012-11-30 " Output i got : 37554 It worked for me , try ur luck Thanks, Harish Shenoy RE: Very interesting issue with regular expression Please Help Me :) - RA185112 - 02-01-2013 Hi, I have encountered an issue, where in I am working on string.So need help. String is str1 = "abcrrera 0200******011" , I am trying to use regular exp as the numbers in the string may change. what is the Patrn that we need to pass?As i have written the code, however i think i am unable to handle "*" spl character in the above string. Here is the function that i have written. However i am unable to get the pattern? Need help Code: Function RegExpTest(patrn ,string) This function is not working. Request you to kindly give a solution to this using reg expression only. Thanks in advance. I tried creating a new post, however i am not sure, i dont have permissions , so i am using the relevant tread. Regards, Ras |