How do you replace multiple instances of '+' in a string in JavaScript? <p>I have a URL that I need to manipulate. I cant seem to replace all the '+' within a query string with whitespace.</p> <pre><code>var url = window.location.replace(/+/g, ' '); </code></pre> <p>What am I doing wrong here?</p> <p>Or is there a better method?</p>