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
Post a Comment