regex-date.pl to HTML.

index -|- end

Generated: Sat Oct 12 17:23:16 2013 from regex-date.pl 2012/12/31 638. text copy

#!/usr/bin/perl -w
#< regex-date.pl - 20121231

my @examples = ( "Mon, Dec 31, 2012 at 12:27 PM ",
    "Sat, Dec 22, 2012 at 3:58 PM " );
my ($date,$day,$mth,$dt,$yr,$tm,$amp);

sub prt($) { print shift; }

foreach $date (@examples) {
    #                1       2       3        4            5           6
    if ($date =~ /^(\w+),\s+(\w+)\s+(\d+),\s+(\d+)\s+at\s+(\d+:\d+)\s+(\w+)\s*$/) {
        $day = $1;
        $mth = $2;
        $dt  = $3;
        $yr  = $4;
        $tm  = $5;
        $amp = $6;
        prt("$day, $mth $dt, $yr at $tm $amp\n");
    } else {
        prt("FAILED\n");
    }
}
    
# eof

index -|- top

checked by tidy  Valid HTML 4.01 Transitional