Those functions take separate parameters for year, month, day, etc. You'd need some glue code to parse the string of digits into those parts. Eg:
if ($stringToTest =~ m/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/ &
+&
check_date($1, $2, $3) &&
check_time($4, $5, $6) )
{
print "It's OK\n";
}
I suspect there's a way to simplify that regular expression - too much repetition!
--
use JAPH;
print JAPH::asString();
| [reply] [d/l] |
>perl -wMstrict -le
"my $s = '20090527051000';
my @matches = $s =~ m{ \A \d{4} | \d{2} }xmsg;
print qq{@matches};
"
2009 05 27 05 10 00
| [reply] [d/l] |
even if we give
$s = '20090230051000';
o/p is
2009 02 30 05 10 00
I am looking for validation of dates. As you can see its displaying 30th feb, which is not right.
| [reply] |