Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE2 (PHP >=7.3)

/
^\[([\d]{1,2}-[\w]{3,9}-[\d]{4}\s+[\d]{2}:[\d]{2}:[\d]{2}\s+[A-Z]{3,4})\]\s((?s).+?)(?=(?:^\[.+\])|\Z)
/
gm

Description

Matches multiline entries (e.g. those containing exception stack traces or just multiline values) in a PHP error log produced by error_log().

Submitted by Anton Ukhanev - 3 years ago (Last modified 3 years ago)