in reply to Re: How to validate the year of a date?
in thread How to validate the year of a date?
or maybe the user should be indulged when entering strings like "02", "99", etc, which entails something messier, like:... unless $yearfield =~ /^\d{4}$/;
(In this case, naturally, one shouldn't expect this script to still be in use after 2009, nor should users ever want to refer to years in the 19th century -- I have no problem with that.)... unless $yearfield =~ /^(\d{2}){1,2}$/; if (length($yearfield) == 2) { $millen = ( $yearfield =~ /^0/ ) ? "20" : "19"; $yearfield = $millen . $yearfield; } ...
|
|---|