Re: date validation via regex

Yitzchak Scott-Thoennes <[email protected]> Tue, 15 Nov 2011 13:47:07 -0800
Newsgroups gmane.comp.lang.perl.fun
Message-ID <CAN7g7HWMVVxO8jqUv=2WN9+G78u=Vq2xxMkdAdeGDweY_AcpHw@mail.gmail.com>
On Tue, Nov 15, 2011 at 11:10 AM, Brian Fraser <[email protected]> wrote:
> No. Just, no.

On this list, I think that counts as high praise.  Thanks!

> Read this:
> http://stackoverflow.com/questions/4077896/perl-or-python-convert-date-from-dd-mm-yyyy-to-yyyy-mm-dd/4078817#4078817

Err, which part?  tchrist is an expert on dealing with unicode in
various languages/regex engines and in real-world "text" data, but I
think he's overreaching there; I don't expect my date strings to
include non-ASCII digits.  I can see some software butchering - into a
non-ASCII dash character, but I'd tend to treat fixing that as a
separate problem.  (Though that was actually a motivation in having my
regex looking for /, not -.)

> Then forget about using regexen and find a module to do it for you.
> Regexp::Common::time is pretty nice, albeit slow if you are doing millions
> of validations.
> (But in the spirit of this list, sure, that's cool. Would be cooler if you
> could abstract it using (?(DEFINE)) :)

Meh.  I think that would only obfuscate it.