Please help with the regular expression - 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: Please help with the regular expression (/Thread-Please-help-with-the-regular-expression) |
Please help with the regular expression - jinnah - 09-06-2012 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 RE: Please help with the regular expression - ssvali - 09-06-2012 It is not .*, it is only *. Ex :- Person:* RE: Please help with the regular expression - Ankesh - 09-07-2012 try this if only the number changes. "^Person:[0-9]+" RE: Please help with the regular expression - jinnah - 09-12-2012 Thank you very much RE: Please help with the regular expression - jinnah - 09-17-2012 Surprisingly No Regular expression workd! Any other idea! \d is for any number, right? RE: Please help with the regular expression - Ankesh - 09-17-2012 @ 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. RE: Please help with the regular expression - jinnah - 09-19-2012 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. RE: Please help with the regular expression - Ankesh - 09-24-2012 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 RE: Please help with the regular expression - jinnah - 09-26-2012 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 |