Regular Expressions 101

Community Patterns

1...34567...902

Community Library Entry

4

Regular Expression
PCRE (PHP <7.3)

/
(\((?:([^\(\)]*)|(?:(?2)(?1)(?2))*)\))
/

Description

Finds the outermost pair of parentheses. Compatible with any amount of nesting

Submitted by Jonas Gerneth - 11 years ago