title: remove duplicate forward slashes from the URL
body: <p>How can I remove duplicate forward slashes from the a url, but keep the // which comes after <code>http:</code> so that the URL does not break.</p>
  
  <pre><code>http://localhost//example/author/admin///
  </code></pre>
  
  <p>should be</p>
  
  <pre><code>http://localhost/example/author/admin/
  </code></pre>
  
  <p>I'm trying this, but it will remove only the last slash. I want to remove all double </p>
  
  <pre><code>abc = 'http://localhost//example/author/admin///';
  clean_url = abc.replace(/\/$/,'');
  alert(clean_url);
  </code></pre>
  
  <p>The following checks only three slashes.</p>
  
  <pre><code>clean_url = abc.replace("///", "");
  alert(clean_url);
  </code></pre>
  
  <p>I want to remove all the duplicate slashes.</p>