Regular Expressions 101

Community Patterns

Isolate Javascript variable name

1

Regular Expression
PCRE (PHP <7.3)

/
(^var)|(\=(.*))|( )
/
g

Description

Used to isolate the variable name of a JavaScript variable. Works event if there aren't spaces between the variable and the equals sign.

Submitted by Keith Mitchell - 9 years ago