jquery - Regular Expression To Replace Double Slashes with Javascript -


I would like to remove any forward slash in the URL more than once in the sequence:

 < Code> var temp = "/path//to/middle//nowhre/avator2.jpg"; Temp.replace (/ \ / \ //, '/');   

It works for slashes only twice and does only once, but I think it removes any slash in a number of times, and any URL Also does this for the type. I also tried

  temp.replace (/ * [/ +] * /, '/');   

But it does not work. Thanks very much for any help

All the scenes of two or more / have a single / : temp.replace (/ \ / {2,} / g, '/' );

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -