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