Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
["'`](?:(?<=")[^"\\]*(?s:\\.[^"\\]*)*"|(?<=')[^'\\]*(?s:\\.[^'\\]*)*'|[^`]*`)
/
g

Description

Verbose, somewhat cryptic and very efficient pattern to match all text inside of quotes and MySQL identifier tokens.

Submitted by Phillip Weber - 7 years ago