All you need to know is in the question. I have a search query in the URL that looks like this:
http://www.mysite.com?param=word1+word2+word3
So far, I can retrieve “word1+word2+word3” but I can’t seem to use something like:
document.write(str.replace(/+/g," "));
I want the final output to look like this: “word1 word2 word3”
Thanks for looking.
Try to escape the
+sign using the escape char\since is a restricted char:http://www.regular-expressions.info/javascript.html