Regular Expressions 101

Community Patterns

Community Library Entry

0

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 - 4 years ago