Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Regular Expression- Date
#1
Solved: 10 Years, 8 Months, 3 Weeks ago
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 !!!!
Reply
#2
Solved: 10 Years, 8 Months, 3 Weeks ago
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.
Reply
#3
Solved: 10 Years, 8 Months, 3 Weeks ago
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.
Reply
#4
Solved: 10 Years, 8 Months, 3 Weeks ago
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.
Reply
#5
Solved: 10 Years, 8 Months, 3 Weeks ago
You can use DateValue function to make the string to a proper date value. And then use regular expression.
Reply
#6
Solved: 10 Years, 8 Months, 3 Weeks ago
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to click on a date button? Parthasit033 0 1,823 09-06-2017, 01:49 AM
Last Post: Parthasit033
  Need Any digit in xpath path using Regular expression Priyam 1 3,248 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,389 12-08-2014, 06:38 PM
Last Post: anshika.agarwal

Forum Jump:


Users browsing this thread: 1 Guest(s)