regex - RegExp and special characters -
I need to use regexp to match and the code below works fine. However, I should keep dollar sign ($) as a true dollar mark and not a special character.
I have tried to leave but nothing is working.
IE: [^ $]
Here is the code. It works as expected, except $ or IS $.
textNode = "$ 19,000"; Regex = RegExp ("$ 19,000", 'ig'); Text = '$'; TextReplacerFunc: Function (TextNode, Reggae, Text) {var sTag = '& lt; Span class = "highlight"> "; Var istag = '& lt; / Span & gt; '; Var re = '(?! [^ <> <>]>> (' + Text + '(?! # 8212;));'; Var regExp = new RegExp (again, 'IIG'); TextNode.data = textNode.data.replace (regExp, sTag + '$ 1' + tag); },
RESULT: $ not highlighted desired result: $ 19,000
Be sure to avoid $
:
text = '\\ $';
Since you are creating a RegExp
example using a string here
Comments
Post a Comment