You have an extra space between
.* and
recvd, using
\s it reads
.*\s\srecvd. You should use
\s for spaces to avoid subtle errors like this.
Also including
/xms; is good as then you can add comments it forces you to use
\s
my $line
= "Fri May 29 18:29:57.357 2009 Morocco Standard Time INFO: pid 32
+16 tid 1724: 170: 132192: apricocot Native Server: recvd AA_BIN_MSG_V
+ER_CHG";
my $MATCH_TIMESTAMP = qr{
\A
( .*? ) # Capture time-stamp
\s
INFO:
.*?
recvd \s AA_BIN_MSG_VER_CHG
}xms;
if ( $line =~ $MATCH_TIMESTAMP ) {
# Made timestamp lexical, you might not want that.
print my $timestamp = $1;
}
J,