-1

Could you please help with a RE that will extract Date in HTML stream. e.g needed date is Wednesday, April 25 2012

Thanks

Babajide Prince
  • 552
  • 1
  • 10
  • 25
  • @RezaSanaie Yes, I have, what do you think? We know your type.. *upsetP – Babajide Prince Apr 27 '12 at 19:53
  • @MikeMcMahon, thanks for your help, tried `(?:(?:[1]{1}\\d{1}\\d{1}\\d{1})|(?:[2]{1}\\d{3})))(?![\\d]` but the behaviour is eratic. I need to extract a valid date from am HTML stream. So I do not have the physical date object to manipulate. Thanks for your effort. – Babajide Prince Apr 27 '12 at 19:55
  • You don't necessarily have to capture the day of the week since that is easily calculated...although you could check for inconsistencies. – rob Apr 27 '12 at 20:08

1 Answers1

2
(Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday),?\s+(January|February|March|April|May|June|July|August|September|October|November|December)\s+[0-3]?[0-9],?\s+[0-2][0-9][0-9][0-9]

But note that it will also find invalid dates, like ones with February 31.

Dmytro Shevchenko
  • 33,431
  • 6
  • 51
  • 67
  • 1
    It also finds Sunday, January 00 0000, and Saturday, December 39 2999 (and everybody knows December 39, 2999 falls on a Wednesday). – rob Apr 27 '12 at 20:02