Regular Expressions 101

Community Patterns

Brace matching for ( and ) parens

0

Regular Expression
PCRE (PHP <7.3)

/
( \( # Match all but characters `\`, `(` or `)` (?> [^\\()] | \\. | (?1) )* \) )
/
gx

Description

Escaped characters should be ignored, hence \( and \) should not affect braces.

Submitted by anonymous - 8 years ago