Regular Expressions 101

Community Patterns

Grab double or single quoted text, escape aware

1

Regular Expression
PCRE (PHP <7.3)

/
^(['"])((?:\\.|(?!\1).)*+)\1$
/
gm

Description

^$ are only added for the test cases, handles escapes and the closing \" situation

Submitted by robin - 10 years ago