Test, validate and match regular expressions
This PCRE recursive pattern matches a complete, balanced pair of outer parentheses, including any arbitrarily nested parentheses within. It works by either matching simple non-parenthesis content, or recursively invoking itself (?1) to handle nested groups. Useful for extracting full parenthesized expressions from math formulas or code where nesting depth is unknown.