I’m looking for a regular expression that can find the alpha representation of a month, along with the numerical year followed by it.
Examples:
-
Today’s month is June 2012
-
This is a setence containing a date for may 2012 and that is all.
-
December 2012
- June 2012 is the date of this year
For your specific examples you can do it with an alternation for the names of the months, and
\d{4}for the year:The
iis for case-insensitive.The
\bare word boundaries.I’m assuming that the years are any four digits, though you may of course want to extend (or restrict) this range, depending on the needs of your application.