Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: ultimate date check regexpby davorg (Chancellor) |
on Oct 30, 2006 at 09:27 UTC ( [id://581236]=note: print w/replies, xml ) | Need Help?? |
A regex that checks values like that is going to be far too complex to maintain. You're better off using a function that checks for valid dates. The timelocal function from Time::Local, converts a list of values (like those returned from localtime) into a epoch seconds value and it dies if passed an invalid date. You can use eval to catch and report on those errors.
It's simple enough to wrap that up into a is_valid_date function.
-- <http://dave.org.uk> "The first rule of Perl club is you do not talk about
Perl club."
In Section
Seekers of Perl Wisdom
|
|