Sunday, 15 August 2010

jquery - Regular Expression To Replace Double Slashes with Javascript -



jquery - Regular Expression To Replace Double Slashes with Javascript -

i remove forwards slashes in url more 1 time in sequence. far:

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

this works double slashes , 1 time removes number slashes more 1 time , occurance in url. tried

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

but doesn't work. help much appreciated. give thanks you

replace sequences of 2 or more / single /: temp.replace(/\/{2,}/g,'/');

javascript jquery regex

No comments:

Post a Comment