Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
\[(?<time>(?:[\d]+\:[\d]+:[\d]+)\s+(?:AM|PM))(?:\s+\|\s+\w+\s+(?<edited>(?:[\d]+\:[\d]+:[\d]+)\s+(?:AM|PM)))?\]\s+(?<author>\w+)\:\s+(?<message>[\w\s,.]+)
/
gm

Description

Simple regex to extract some chat conversation

Submitted by anonymous - 4 years ago