I have a small templating system in javascrip, where the user can put tags in the form $tagname$. I can match all tags with the patter: /\$\w+\$/.
Also, I want to match incomplete tags specifically (it would start with $ and finish with a word boundary that is not $). I can't use /\$\w+\b/ because $ is also a word boundary (so it will also match correct tags). I tried with this but it does not work: /\$\w+[^\$]/.
It matches the incomplete tag in this string "word $tag any word", but it also matches this "word $tag$ any word".
What is the correct ending for that regular expresion?