jiduvah
jiduvah

Reputation: 5168

Removing Many Backslashes in a string

I have a string that I get from a database with has many backslashes in. I need to take them all out. I have been playing with the .replace function however because there is an undefined number of backslashes I can't work out how to do it.

Any help is much appreicated.

Upvotes: 0

Views: 71

Answers (1)

David Laberge
David Laberge

Reputation: 16051

try :

var str = 'str //// str';
str = str.replace(/\//g,''); // edited to match the comment of jiduvah

Upvotes: 1

Related Questions