If I understand your question/need correctly, you should be able to achieve this using a macro with a typed string trigger, where the typed string is a RegEx pattern.
Maybe something like this:
\$.+\$
That will trigger the macro with any text string that starts and ends with a $ symbol.