can't remove parameter using javascript : <p>i have a url like this</p>

<pre><code>test.html?dir=asc&amp;end_date=2016-09-23&amp;order=created_at&amp;start_date=2016-08-14
</code></pre>

<p>i want to remove the parameter using the following javascript</p>

<pre><code>function removeParam(uri) {

   uri =  uri.replace(/([&amp;\?]start_date=*$|start_date=*&amp;|[?&amp;]start_date=(?=#))/, '');

   return uri.replace(/([&amp;\?]end_date=*$|end_date=*&amp;|[?&amp;]end_date=(?=#))/, '');
}
</code></pre>

<p>but it didn't work, anyone know what's wrong with that?</p>
