Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

/
(^\w+\s\d+\s+\d+:\d+:\d+)\s+\w+\.\w+\s+[\w=\w+]+\[(\d+)]
/
gm

Description

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