Regular Expressions 101

Community Patterns

Locate all quoted (single or double) text, handling nested and also ignoring when in the first param of a ".replace("

0

Regular Expression
PCRE2 (PHP >=7.3)

/
\(\s*.*?\w*\h*,(*SKIP)(*F)|(?|(")[^"\\]*(?:\\.[^"\\]*)*"|(')[^'\\]*(?:\\.[^'\\]*)*')
/
gm

Description

See https://onlinephp.io/c/a21b4 for PHP preg_replace_callback results

Submitted by anonymous - a year ago