![]() |
Help Again with 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: Help Again with regular expression (/Thread-Help-Again-with-regular-expression) Pages:
1
2
|
Help Again with regular expression - jinnah - 09-12-2012 Hi, I need help with regular expression again. scenario is to handle dynamic date and time Ex: 09/11/2012 9:10 AM Another one is just 2 string Ex : Grant Approved RE: Help Again with regular expression - SIBICA - 09-12-2012 Hi Jinnah, Date Regular Expression: Format: MM/DD/YYYY MM: (0[1-9]|1[0-2]) DD: (0[1-9]|1[0-9]|2[0-9]|3[0-1]) YYYY: ([0-9][0-9][0-9][1-9]|[1-9]000|[1-9][1-9]00|[1-9][1-9][1-9]0) * Assuming that Max year is 9999 Time Regular Expression: Here Max Time: 23:59:59 and Min Time: 00:00:00 Hours: ([0-1][0-9]|2[0-3]) Mins: ([0-5][0-9]) Secs: ([0-5][0-9]) | Choice between two lines ( ) Used to group multiple regular expressions [-] To specify a range Try this it may helpful... I am not sure about the 2nd thing... Regards, Sibi C A RE: Help Again with regular expression - jinnah - 09-12-2012 Awesome! What if i need to combine both date and time ? What conjunction should be used? Thank you very much again. RE: Help Again with regular expression - SIBICA - 09-13-2012 Ex1 : MM/DD/YYYY Ex2 : Hours:Mins:Secs Include the regular expressions instead of MM DD YYYY Hours Mins Secs.For Dynamic date use '/' (see Ex1) as conjuction.Like this, you can use conjuction ':' (see Ex2) in dynamic time. Regards, Sibi C A RE: Help Again with regular expression - jinnah - 09-14-2012 I actually need the whole date and time in one regular expression. And I still have problem handling a text string like "negligent sale of goods and services" Thanks for the help RE: Help Again with regular expression - jinnah - 09-19-2012 Code: InjuredPerson=Browser("ClaimCenter_Br").Page("ClaimCenter_Pg").WebList("InjuredPerson_PIP").GetROProperty("selection") Number 8 is dynamic. I tried "#[0-9]" "#[0-9]+" "#*" "#d\" "#d\+" None workd Except "#8". I am facing same kind of problem in several places. Where only numbers get changed. Need solution badly. RE: Help Again with regular expression - Ankesh - 09-24-2012 @ Jinnah, You can not simply compare the regular expression using conditional statement. Let me explain it to you. Below are the basic steps that you need to follow. 1. You need to create an object of VbScript.RegExp 2. Assign the pattern you want to test. 3. Pass your string and check the result. It only returns true/False for successful/Unsuccessful results. Let me give you one example. Code: Set RegEx = CreateObject("VBScript.RegExp") Let me know if you need more help. Regards, Ankesh RE: Help Again with regular expression - jinnah - 09-25-2012 Great! I will try it today. I will let you know.Hope it will work. Thanks buddy RE: Help Again with regular expression - jinnah - 09-26-2012 Hi Finally I could make it work Thanks buddy! Code: SelectionItem=Browser("").Page("").WebList("").GetROProperty("selection") Thank you very very very much RE: Help Again with regular expression - Ankesh - 09-27-2012 Glad that it worked for you. ![]() |