title: javascript regex to remove a substring from string
body: <p>I have the following url </p>
  
  <pre><code>example.com/p/deals&amp;post_id=3
  </code></pre>
  
  <p>where post id is a get variable. I would like to sanitize the url string and the returned result should  be  </p>
  
  <pre><code>example.com/p/deals
  </code></pre>
  
  <p>I have been trying to use JavaScript's <code>.replace</code> but because of the get variable at the end of url, doesn't seems to work. How would I build a regex to exclude this substring.</p>