Regular Expressions 101

Community Library

Community Library Entry

1

Regular ExpressionOpen Workspace

/
(?<!\\) (?P<pregunk>(?:\\\\)*) # dont match an odd amount of \ before (?P<open>\() (?P<contents> (?:\\\\)* # even amount of \ (?: (?: [^()\\] # not ( or ) | \\[()\\] # \( \) and \\ are ok ) | (?R) # the entire pattern again )* (?<!\\) (?:\\\\)* ) (?P<close>\))
/
gmx

Description
Created·2026-02-10 03:26
Updated·2026-02-12 01:11
Type·Match
Flavor·PCRE2 (PHP)

Grabs the outer parentheses and contents taking into account inner parentheses enclosures

Submitted by bicorn
Open Workspace