1

I have this string:

http:\/\/www.emptyurl.com\/

And i want to change the url to :

http://www.emptyurl.com/

With :

url = url.replace(/\\//gi, "/");

But it give me empty string.

Any idea how i can fix it?

1

1 Answer 1

0

You can use decodeURIComponent()

var url = 'http:\/\/www.emptyurl.com\/';
url = decodeURIComponent(url);
console.log(url);
Sign up to request clarification or add additional context in comments.

1 Comment

Please notice <> icon in editor. You can make a snippet using that

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.