Does anyone have an egrep regular expression (regex) for valid dates in the format YYYYMMDD?
It's fairly simple for basic checking, for example the DD bit could be:
[0-3][0-9] but that doesn't catch invalid days like 38.
if I write a full regex, starting with ^ and ending in $, I can then use the | (the OR option) along with a second full regex to capture the two cases of [0-2][0-9] and [0-1], however that is quite long. (ie. ^<full regex>$|^<second full regex>$)
Ideally I'd like to be able to do an embedded OR within a single regex to capture that 29 is a valid day by 39 is not. But I can't figure out how to do that.
Of course, something that captured leap years and fancy stuff like that would be awesome, but I'm not holding my breath on it. :)