I need help coming up with a regex to make sure the user enters a valid date
The string will be in the format of mm/dd/yyyy
Here is what I have come up
Is regular expression a must? If not, you better off using a different approach, such as DateTime::Format::DateManip
my @dates = (
'04/23/2009',
'01/22/2010 6pm',
'adasdas',
'1010101/12312312/1232132'
);
for my $date ( @dates )
{
my $date = DateTime::Format::DateManip->parse_datetime( $date );
die "Bad Date $date" unless (defined $date);
print "$dt\n";
}