title: Replacing carets in Javascript
body: <p>I'm trying to replace multiple carets (^) in a string with spaces in Javascript. Following the w3schools entry on replace(), I used this code:</p>
  
  <pre><code>var str = "Salt^Lake^City, UT";
  var result = str.replace(/^/g, " ");
  </code></pre>
  
  <p>However, value of <code>result</code> is " Salt^Lake^City, UT". One caret is replaced when I run this code:</p>
  
  <pre><code>var result = str.replace("^", " ");
  </code></pre>
  
  <p>but I want to replace all of an arbitrary number of carets. Is there something obvious I'm missing about globally replacing in Javascript? I could write a function using <code>str.replace("^", " ");</code> to remove all the carets, but I'd rather use the built-in global replace.</p>