title: javascript regexp replace not working, but string replace works
body: <p>I'm working with jQuery and am trying to write a pattern replace, but it doesn't work. I have this:</p>
  
  <pre><code>var $featured_rewrite = $('#featured').not('.slideshow');
  $featured_rewrite.children().attr('href', $featured_rewrite.find('img').attr('src').replace('/-[0-9]+x[0-9]+\./i', '.'));
  </code></pre>
  
  <p>I don't understand why something like this works:</p>
  
  <pre><code>.replace('-500x277.', '.')
  </code></pre>
  
  <p>but not this, which I even checked with a tool and made sure it was valid and works:</p>
  
  <pre><code>.replace('/-[0-9]+x[0-9]+\./i', '.')
  </code></pre>