A day has one or two digits

jdavidb on 2005-12-05T16:55:12

Never extract a date using qr/\d\d/ to represent the day of the month. (Unless you have a spec to reference. Ha!) A date to many people is a \d+. In other words, some people (and even programs) represent the mday component of 2005-12-03 as simply " 3" or even "3" instead of the more proper "03".

Thankfully I at least followed my usual practice of using \s+ instead of " " between elements in the date string or I might have had even more confusion.


Regexp::Common::Date desirable

n1vux on 2005-12-05T21:21:46

A date to many people is a \d+

How about \d{1,2}?

There are longer, uglier things that will match 1..9|01..09|11|12 and 01..31|1..31, but they're ugly.

Alas, Regexp::Common::Date is still a coming attraction.