Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE2 (PHP >=7.3)

/
((\s*\b([a-zA-Z_]*)\b)\s*((\s*=\s*(('[\w\-_#@,.!@#$%^&*()\s]*')))|((\s+\bLIKE\b\s+('[\w\-_#@,.!@#$%^&*()\s]*')))|(((\s+\bIN\b\s+\('[\w\-_#@,.!@#$%^&*()\s]+'(, '[\w\-_#@,.!@#$%^&*()\s]+')*\)))))((\s*\b(AND|OR)\b\s*)(\s*\b([a-zA-Z_]*)\b)\s*((\s*=\s*(('[\w\-_#@,.!@#$%^&*()\s]*')))|((\s+\bLIKE\b\s+('[\w\-_#@,.!@#$%^&*()\s]*')))|(((\s+\bIN\b\s+\('[\w\-_#@,.!@#$%^&*()\s]+'(, '[\w\-_#@,.!@#$%^&*()\s]+')*\))))))*)
/
gm

Description

Not fully compliant, please don't use for security or for anything extremely important. Might be a good jumping off point though (although its a bit hellish looking)

Submitted by anonymous - 5 months ago