I\'m not sure how to escape \'+\' in regex. Plus can come multiple times in i so we need to replace all + in the string. Here\'s what I have:
The + character has special significance in regular expressions. It's a quantifier meaning one or more of the previous character, character class, or group.
You need to escape the +, like this:
i.replace(new RegExp("\\+","g"),' ')...
Or more simply, by using a precompiled expression:
i.replace(/\+/g,' ')...