Hi everyone. I use a javascript replace function to modify certain characters that I send in the URL. It work fine for most of them but when it comes to the + sign, I can only replace it once. Here is a sample of the replace I used :
string.replace(/%/gi,'%25').replace(/&/gi,'%26').replace(/#/gi,'%23').replace('+','%2B');
If I try to change the replace for the + sign to replace(/+/gi,'%2B') so that it replace all the signs I get an Unexpected quantifier error.
Is there something special about the + sign that I don't know ? It work for all the others but this one so I'm a little confused.
Any help would be greatly appreciated.
string.replace(/%/gi,'%25').replace(/&/gi,'%26').replace(/#/gi,'%23').replace('+','%2B');
If I try to change the replace for the + sign to replace(/+/gi,'%2B') so that it replace all the signs I get an Unexpected quantifier error.
Is there something special about the + sign that I don't know ? It work for all the others but this one so I'm a little confused.
Any help would be greatly appreciated.