Regular Expressions 101

Community Patterns

Parsing a Log File Entry


Regular Expression
PCRE2 (PHP >=7.3)



This regular expression matches the start of the string at the position where we have one or more alphanumeric characters followed by a space. Afterwards, we have a digit (one or more). Later, we have one or more spaces followed by a time format followed by a space and alphanumeric characters. The interesting part is the use of parenthesis to create match groups. There are two match groups that will be created.

Submitted by Muhammad Afroz Khan Ghauri - a year ago