title: Literal dollar sign in a regular expression
body: <p>I am working with Canada (fr-CA) locale and trying to do following:</p>
  
  <pre><code>var str = "&lt;dataset &gt;{1}&lt;/dataset&gt;";
  var temp = "&lt;set Cost x = '1,8M $' /&gt;";
  
  str = str.replace(/\{1\}/g, temp);
  </code></pre>
  
  <p>OUTPUT: </p>
  
  <pre><code>"&lt;dataset &gt;&lt;set Cost x = '1,8M  &lt;/dataset&gt;" /&gt;&lt;/dataset&gt;"
  </code></pre>
  
  <p>DESIRED OUTPUT: </p>
  
  <pre><code>"&lt;dataset &gt;&lt;set Cost x = '1,8M $'" /&gt;&lt;/dataset&gt;"
  </code></pre>
  
  <p>replace function is misunderstanding <code>$</code>' from <code>'1,8M $'</code> as an expression and hence<br>
  repeating  in the output. Any ideas/workaround? Thank you for your time.</p>