Is it possible to use a regex to match "February 2009", for example?
+3
A:
Along the lines of
\b(?:Jan(?:uary)?|Feb(?:ruary)?|...|Dec(?:ember)?) (?:19[7-9]\d|2\d{3})(?=\D|$)
that's
\b # a word boundary (?: # non-capturing group Jan(?:uary)? # Jan(uary) |Feb(?:ruary)? # |... # and so on |Dec(?:ember)? # Dec(ember) ) # end group # a space (?: # non-capturing group 19[7-9]\d|2\d{3} # 1970-2999 ) # end group (?=\D|$) # followed by: anything but a digit or the end of string
Tomalak
2010-04-16 19:08:58
OBTW, 1990-2010 is `(?:199\d|20[01]\d)`
Tomalak
2010-04-16 19:19:53
@Tomalak: That matches 2019.
KennyTM
2010-04-16 19:22:53
@Kenny: Whoops of course. `(?:199\d|200\d|2010)`
Tomalak
2010-04-16 19:25:04