in reply to regular expression help

I think the simple, straight-forward answer is: don't. Use a regular expression to pull apart the data, and do minor syntax checking, and use other date-related modules to do semantic checking.

Replies are listed 'Best First'.
Re^2: regular expression help
by ikegami (Patriarch) on Jul 26, 2005 at 21:19 UTC
    Here's a solution that uses the core module Time::Local
    use Time::Local qw( timegm ); /(\d{4})[-\/.](\d{2})[-\/.](\d{2})/ or die("Bad format\n"); my $time = eval { timegm(0, 0, 0, $3, $2, $1) }; die("Bad date\n") if $@;
    Switch timegm for timelocal if you prefer.