Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

/
^\{[\s]*\"(tab1|tab3|tab5)".*
/
gm

Description

Regex for checking if JSON starts with desired keys Useful for validating/filtering database entries when used in combination with SQL Like

Example:

Postgre: select * from table_name where column_json ~ '^{[\s]"(tab1|tab3|tab5)".'

Submitted by MUA - 3 years ago