Micro Focus QTP (UFT) Forums
Regular Expression- Date - 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- Date (/Thread-Regular-Expression-Date)



Regular Expression- Date - defecttracer - 05-13-2010

Friends !!

I' working on a Web page which has lots of other objects which i can able to work with.

But, got a date object on the page of this type Wednesday, May 12, 2010 . I could not able to handle this correctly.

So far , I have regularized many dates successfully with only integers though. But now this has

strings, is there any one can able to help me out or correct me where i went wrrrrrrrrronooooooong

date on the page is like this Wednesday, May 12, 2010
I have regularized like this [Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday]/','/ [January|Febuary|March|April|May|June|July|August|September|October|November|December] [0-3][0-3]/','/ [0-9][0-9][0-9][0-9]

waiting for the response !! Thanks for your help in advance guys !!!!


RE: Regular Expression- Date - jsknight1969 - 05-13-2010

Code:
^((Mon|Tues|Wednes|Thur|Fri|Satur|Sun)day),[\s]((J(anuary|uly|une))|February|(M(arch|ay))|(A(pril|ugust))|((Sept|Nov|Dec)ember)|October)[\s][0-9]{1,2},[\s][0-9]{4}

try this one.


RE: Regular Expression- Date - defecttracer - 05-13-2010

Code:
^((Mon|Tues|Wednes|Thur|Fri|Satur|Sun)day),[\s]((J(anuary|uly|une))|February|(M(arch|ay))|(A(pril|ugust))|((Sept|Nov|Dec)ember)|October)[\s][0-9]{1,2},[\s][0-9]{4}

I tried with the s included in Thursday as Thurs but did not work.

Well thanks for your help.


RE: Regular Expression- Date - jsknight1969 - 05-20-2010

Might just be that your string contains more information than the date.

"Today is Thursday, May 20, 2010" would fail because of the "^" (caret) at the start of the regexp string. Remove the "^" (which means starts with) and try again.

You might try replacing the "^" with "[\w\s]+". That way the string can start with any word or whitespace character.


RE: Regular Expression- Date - guin.anirban - 05-20-2010

You can use DateValue function to make the string to a proper date value. And then use regular expression.


RE: Regular Expression- Date - kiranpaul20 - 07-16-2010

Code:
^((Mon|Tues|Wednes|Thurs|Fri|Satur|Sun)day),[\s]((J(anuary|uly|une))|February|(M(arch|ay))|(A(pril|ugust))|((Sept|Nov|Dec)ember)|October)[\s][0-9]{1,2},[\s][0-9]{4}

This works. I have tested it in a regular expression validator.

Kiran Paul
kiran paul