while(<>){ chomp; $_ = 'Use YYYY-MM-DD format' unless s/^(\d{4})-(\d\d)-(\d\d)$/ $1<1 || $2<1 || $3<1 ? 'Year, month, and day must be greater than +0' : $2>12 ? 'Month must be less than 13' : $3>31 ? 'Day must be less than 32' : $3==30&&$2==2 ? 'February has less than 30 days' : $3==29 && $2==2 && $1%4!=0 ? 'February only has 29 days in a leap +year' : $3==31 && $2 =~ m!0[2469]|11! ? '30 days hath September, yada yada +..' : $_ /e; print ": $_ :\n"; }
In reply to Re: Date Validation using just a regex
by delirium
in thread Date Validation using just a regex
by Ananda
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |