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
/
%([^%.]+)%|(?<!\$)\$(?:\{([^{}]+)\}|([^$.\s]+))
/
gm
Input 1
1
New
%ABC% $ABC. $ABC$XYZ To add a bit more to this: ${ABC} should yield ABC too. (ignore curly braces if present - non capture chars perhaps?). if you have two successive dollar signs, such as "$$EFG", or "$${EFG}", that should not appear in a regex result. (This is where either numbered or named back- references come into play - and the reason I contemplated them as non-capture groups). As I understand it, a group becomes a non-capture group with this syntax (?:).
Extraction
%ABC% $ABC. $ABC$XYZ To add a bit more to this: ${ABC} should yield ABC too. (ignore curly braces if present - non capture chars perhaps?). if you have two successive dollar signs, such as "$$EFG", or "$${EFG}", that should not appear in a regex result. (This is where either numbered or named back- references come into play - and the reason I contemplated them as non-capture groups). As I understand it, a group becomes a non-capture group with this syntax (?:).