New regex:
\[(\d{4}-\d{2}-\d{2} )?(\d{2}:\d{2}:\d{2})(\.\d{3})?\] ?(\w*): (.*)
Matches HH:MM:SS and (optionally) YYYY-MM-DD at the start and milliseconds at the end of the timestamp.
|
if(!preg_match("/\[(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.\d{3})] (\w*): (.*)/", $line, $tmp)) continue; |