Regular Expressions 101

Community Patterns

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