title: String.prototype.replace() to remove dashes and underscores
body: <p>I'm trying to remove all ocurrences of dashes and underscores of a string with <code>String.prototype.replace()</code>, but it's not working and I don't know why. My code:</p>
  
  <pre><code>var str = "dash-and_underscore";
  str = str.replace(/_|\-/, " ");
  console.log(str);
  </code></pre>
  
  <p>outputs:</p>
  
  <pre><code>"dash and_underscore"
  </code></pre>
  
  <p>in the Chrome console.</p>
  
  <p>Since the <code>|</code> acts like the <code>OR</code> opperator, what am I doing wrong? I've tried the solution <a href="https://stackoverflow.com/questions/16967503/how-to-match-dot-underscore-underscore/16969686#16969686">here</a>, but it didn't work, or I'm too dumb to understand - which is an option ;)</p>