Skip to content
Sign upLog in

replaceAll not working ( I think so )

Profile icon

I made Ifcurs replace all %20 thingies with + like a real browser. But, sadly, the system does not/can't ( however you say ) replace those + as %20, and then decode them again into normal spaces. Can somebody explain what did I mess with my code?

You are viewing a single comment. View All
Answered by ch1ck3n [earned 5 cycles]
View Answer
Profile icon

Hi, instead of using replaceAll, try using replace:

console.log("xd%20lol%20xd".replace(/%20/g, "+"));

do take note of the g flag, that makes it so replace tries to match as many times as possible. Without it, it will only match the first one.