posted 7 years ago
Since YY or YYYY is not in the data, there would be no control of 0229 vs 0228 month... Even with YY or YYYY, that kind of control would be extremely tedious and "counter-productive" that that kind of control should (28-day Feb or 29-day Feb) better be relegated to the application itself if one needs fine-grained control. Otherwise, one would be contended with 29 as max for 02 MM.
Having said that, what remains is to sit down and enumerate the 30-day, 31-day and 29-day month's patterns. Even though it is not very difficult, it requires a reasonable amount of easiness in working with regex. Here is how it can be done. Once you see it, you may be in a better position to understand how it is constructed and the line of reasoning.
Break it down into components separated by alternative "|" each of them deals with one kind of months.