I simply want to replace all the +'s in a url string with spaces but I get an error with the following code because it is treating the + as a quantifier.
var str=“blah+blah”;
str=str.replace(/+/g, " ");
How do I make this work?
I simply want to replace all the +'s in a url string with spaces but I get an error with the following code because it is treating the + as a quantifier.
var str=“blah+blah”;
str=str.replace(/+/g, " ");
How do I make this work?
>>> str = 'blah+blah';
"blah+blah"
>>> str = 'blah+blah+blah';
"blah+blah+blah"
>>> str.replace(/\\+/, '')
"blahblah+blah"
>>> str.replace(/\\+/g, '')
"blahblahblah"
Directly from firebug js console