in reply to Parsing a data field that is seperated by data/time entries
(update: simplified the part that matches the time field)my $datex = qr/\[ # match open square bracket [FMSTW][a-u]{2} \s # match day of week [ADFJMNOS][a-y]{2} \s+ # match month \d+ \s+ \d+:\d{2}:\d{2} \s \d{4} , \s+ # match date +, time, year \w+ # match username (could be more explicit) \]:/x; # match closing bracket, colon my @text_blocks = split /($datex)/, $textfield; my $initial_junk = shift @text_blocks unless ( $text_blocks[0] =~ /$da +tex/ ); my %entry = ( @text_blocks ); print "DATE=> $_ STRING=> $entry{$_}\n" for (keys %entry);
|
|---|