Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

/
^(\w{3} \d{2} \d{2}:\d{2}:\d{2}) ([a-z]+) ([\w\d\[\]]+): (.*)$
/
gm

Description

Capture the date, host, message type, and message from the patterns in the log file.

Submitted by Nicholas Tower - 3 years ago