Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

/
(?<color>\[(?<hex>[a-fA-F0-9]{6})\](?<text>[\s\w!@#$&()<>\\-`.+,\/\\\"]{0,}))
/
g

Description

Parses string to extract all hex codes in square brackets along with the text after

Submitted by anonymous - 4 years ago