I want to replace a string by another. I found when the replaceValue contains \"$\", the replace will fail. So I am trying to escape \"$\" by
\"$\"
Unfortunately, nothing you can do about it. It's just how JavaScript works with regular expressions.
Here's a good article with the list of all replacement patterns you should be aware of: http://es5.github.io/#x15.5.4.11