I have a string that I would like to replace certain values with empty string. My string is:
"col1=,,,&col2=,&col3=,,&item5,item8," I am trying to replace ",,," with ""
I have tried the following and had no joy, does anyone have any ideas what the best way to achieve this is?
var string = "col1=,,,&col2=,&col3=,,&item5,item8,"; var NewCookie = ""; NewCookie = string.replace(",,", ","); NewCookie = NewCookie.replace(',,,', ','); NewCookie = NewCookie.replace(',,&', ','); alert(NewCookie); Thanks
&item5,item8isn't a valid query string. Can you clarify what format you want?