in reply to regular expression for "time-of-day" is not working

The regex matches 9:02 pm, and since you haven't anchored it, the regex match comes out true even if it didn't match the whole string. Use at least a word boundary:
/\b(1[012]|[1-9]):([0-5][0-9]).([aApP][mM])\b/

See perlretut and perlre for more details.

Replies are listed 'Best First'.
Re^2: regular expression for "time-of-day" is not working
by vjvalor (Initiate) on Apr 05, 2012 at 09:54 UTC
    Thank you moritz.