Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Reg
ular
Ex
pressions
101
Upgrade to Pro
Enterprise
Regular Expression
/
(?<=^ *)(?=\$(?:\{[a-z_][a-z0-9_]*\}|[a-z_][a-z0-9_]*)|[a-z_][a-z0-9_]*)(?:(?:\$\{)?([^ \}]+)\}?)(?= *$)
/
gim
Unit Tests
Simple - Identifier
Simple - Identifier w/ underscore and number
Simple - Identifier with underscore, surrounding whitespace
Advanced - Parameter, no brackets
Advanced - Parameter with no brackets, underscore, whitespace
Advanced - Parameter with brackets
Advanced - Parameter with brackets, underscore, whitespace