title: Remove Single Query String from URL Using Reg Ex and Javascript
body: <p>I've read <a href="https://stackoverflow.com/questions/1842681/regular-expression-to-remove-one-parameter-from-query-string">other</a> pages supplying the RegEx, but the post doesn't seem to be working in my tests.  I'm just wanting to remove the <code>page=X</code> portion from a url string (<code>/search?page=2&amp;some_var=foo</code>).</p>
  
  <p>When I try this:</p>
  
  <pre><code>urlStr = req.url
  urlStr.replace(/&amp;foo(=[^&amp;]*)?|^foo(=[^&amp;]*)?&amp;?/, '')
  </code></pre>
  
  <p>It doesn't remove the page portion.  If I move the page to the end or middle of the string the RegEx elector works.  </p>
  
  <p>Anyone have a better Reg Ex solution?  I'm only going to have a few query strings so I'm pretty sure I'm not going to run into edge cases. </p>