Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Please help with the regular expression
#1
Not Solved
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
Reply
#2
Not Solved
It is not .*, it is only *.

Ex :- Person:*
Reply
#3
Not Solved
try this if only the number changes.

"^Person:[0-9]+"
Reply
#4
Not Solved
Thank you very much
Reply
#5
Not Solved
Surprisingly No Regular expression workd! Any other idea!
\d is for any number, right?
Reply
#6
Not Solved
@ 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.
Reply
#7
Not Solved
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.
Reply
#8
Not Solved
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
Reply
#9
Not Solved
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Need Any digit in xpath path using Regular expression Priyam 1 3,251 10-05-2016, 11:05 AM
Last Post: Ankur
  Regular expression to read two words in lowercase, uppercase and with and without spa sarahq49 1 3,193 04-09-2015, 01:56 AM
Last Post: sarahq49
  Regular expression and script optimisation Padmavathy 1 3,612 03-30-2015, 11:46 AM
Last Post: supputuri
  Regular expression in descriptive programming testernc 1 16,392 12-08-2014, 06:38 PM
Last Post: anshika.agarwal
  need a regular expression. anu05446 0 3,008 11-26-2014, 03:00 PM
Last Post: anu05446

Forum Jump:


Users browsing this thread: 1 Guest(s)