Micro Focus QTP (UFT) Forums
Regular expression for this string - 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: Regular expression for this string (/Thread-Regular-expression-for-this-string)



Regular expression for this string - falvi - 04-27-2012

hello every one,

i'm kinda new to the regular expressions concept, and i've to create a regular expression for a dynamically generated string which has following format...

abc11_a_a_a11a1234_abcd_4ab5_a1ab_a1234b5c6d7e_AbcdefgHijklmnopqr12_AbcdefgHigklmnopqr12_ABCdef

i need help in two ways for this one.

  1. 1: what could be the regular expression for this full string?
  2. 2: can i just create regular expression for this part (abc11_a_a_a11a1234_abcd_4ab5_a1ab_a1234b5c6d7e_) and just append the rest of the string as it is, would it still work, because only the part in () is dynamically generated, rest is pretty much static...



RE: Regular expression for this string - srikanthqtp - 04-29-2012

Hi Kinda,

If you no need to valideate anything with in the () which is (abc11_a_a_a11a1234_abcd_4ab5_a1ab_a1234b5c6d7e_) you can very well use below regular experssion to identify

RegEx: (.*)AbcdefgHijklmnopqr12_AbcdefgHigklmnopqr12_ABCdef


RE: Regular expression for this string - falvi - 04-30-2012

so i'd be using this regex. like this ?

Code:
TestObj("innertext").value = .*AbcdefgHijklmnopqr12_AbcdefgHigklmnopqr12_ABCdef


???