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] =~ /$datex/ ); my %entry = ( @text_blocks ); print "DATE=> $_ STRING=> $entry{$_}\n" for (keys %entry);