I need to use regexp for matching and the code below works fine. However, I need to KEEP the dollar sign ($) as a true dollar sign and not a special character.
I've tried excluding but nothing is working.
IE: [^$]
Here's the code. It works as expected except when the text contains a $ or IS the $.
textNode = "$19,000";
regex = RegExp("$19,000",'ig');
text = '$';
textReplacerFunc: function (textNode, regex, text) {
var sTag = '<span class="highlight">';
var eTag = '</span>';
var re = '(?![^<>]*>)(' + text + '(?!#8212;))';
var regExp = new RegExp(re, 'ig');
textNode.data = textNode.data.replace(regExp, sTag + '$1' + eTag);
},
RESULT: $ not highlighted. desired results: $19,000