I want to match expressions that begin with "${"
and end with "}"
in the expression ${foo} and ${bar}
.
The regex .*\$\{.+\}.*
matches the entire expression, of course.
My understanding was that changing to the reluctant quantifier would solve the problem, but I find that .*\$\{.+?\}.*
also matches the entire expression.
What am I missing?
As well as the suggestion by 1800 INFORMATION i would change the dot to something else:
\$\{[^\}]+\}
As the +
will match as much as it can even a }
if you have two occurances of ${}
in the string.