Posts: 20
Threads: 6
Joined: Sep 2012
Reputation:
0
09-06-2012, 08:58 AM
Hi, I am new to QTP. In my work I have some problem with verification . How can I handle the following string with regular expression?
Person:34658
numbers get change in every iteration. I just need to replace the number or whole thing. I tried with (.*) to replace the whole string. it didn't work. I tried Person:\d. It didn't work as well. please help. Thanks
Posts: 121
Threads: 8
Joined: Apr 2012
Reputation:
2
09-06-2012, 03:01 PM
It is not .*, it is only *.
Ex :- Person:*
Posts: 424
Threads: 10
Joined: Aug 2011
Reputation:
0
09-07-2012, 12:09 PM
try this if only the number changes.
"^Person:[0-9]+"
Posts: 20
Threads: 6
Joined: Sep 2012
Reputation:
0
09-17-2012, 10:01 AM
Surprisingly No Regular expression workd! Any other idea!
\d is for any number, right?
Posts: 424
Threads: 10
Joined: Aug 2011
Reputation:
0
09-17-2012, 12:46 PM
@ jinnah,
"^Person:[0-9]+" works absolutly fine for the text which you have posted.
I hpe you are trying to regularize a different expression. Plz post wht are you trying to achieve.
Posts: 20
Threads: 6
Joined: Sep 2012
Reputation:
0
09-19-2012, 08:56 PM
Thats true I am trying to handle different strings with regular expression. Just today I need to handle #followed by number. For example #8. Number is dynamic. I tried "#d\" , "#d|+" Or at least ".*" should work for the whole thing. right? But i have hard time getting the verification passed. The problem is with dynamic lists. I need to verify that certain value is selecetd from list.
Posts: 424
Threads: 10
Joined: Aug 2011
Reputation:
0
09-24-2012, 06:22 PM
ok understood.!!!
Plz note first you need to have understanding of regular expression characters, its significance, escape characters etc.
I would request you to first google it and then try to develop your code.
You can try testing your regular expression using Regular expression evaluator under Tool in QTP11( not sure abt other versions).
Regards,
Ankesh
Posts: 20
Threads: 6
Joined: Sep 2012
Reputation:
0
09-26-2012, 03:43 AM
Thanks Ankesh. You are great! I am using QTP 10. There is no Regular expression evaluator in thsi version. Do you know any other Regular expression generator. I will learn Regular expression very well. But for the time being i need something. Thanks