August 12, 2012
Regular Expression, match ${ANY_TEXT}
Question by CappY
Can you please help me with reg ex. I cant make it 🙁 I hate regex.
I need to match this string ${ANY_TEXT} .Exactly one “${” and exactly one closing tag “}”.
Thanks a lot. 🙂
Answer by Shi
${[^}]+} will match it. It will match ${ABC} from ${ABC}}} as well. If you want to match complete lines, simply anchor the regular expression using ^${[^}]+}$.
A good site to learn regular expressions is http://www.regular-expressions.info/.