title: replace() does not replace the selected text
body: <p>I want to remove <code>/view-photo/P1270649</code> from an URL that I have. I'm currently using this to do so:</p>
  
  <pre><code>var pathname = window.location.pathname;
  var replaced = pathname.replace('/view-photo/' + /([A-Z0-9]+)/g, '');
  </code></pre>
  
  <p>However, nothing happens when I try to use this. You can <a href="http://jsfiddle.net/edgren/nrNrP/" rel="nofollow">see it in action on JSFiddle</a>. How can I fix this issue?</p>