Regular Expressions 101

Community Patterns

1...45678...901

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