I have this string:
http:\/\/www.google.com\/
And i want to change the url to :
http://www.google.com/
With :
url = url.replace(/\\//gi, "/");
But it give me empty string.
Any idea how i can fix it?
You need an extra backward slash. \
You could try this:
var url = 'http:\/\/www.google.com\/';
url.replace(/\\\//gi, "/");
You're looking for decodeURI
decodeURI('http:\/\/www.google.com\/')
//"http://www.google.com/"
/\\\//g:url.replace(/\\\//g,'/'), escape both the backslash and the regex delimiting forward slash