Regular Expressions 101

Community Patterns

get js config vars

1

Regular Expression
PCRE (PHP <7.3)

/
{.+|(?<=var)\s+([^\s]+)\s*=\s*['"]([^'"]+?)['"];
/
gs

Description

grabs the name and value of any js variables that come before brackets

Submitted by warnock - 9 years ago