Erhan Uslu
Erhan Uslu

Reputation: 15

jquery replace string with backslash to space

 data[i].replace('\\10.10.12\AxDocuments\', '') 

I am trying to replacing this string to space but I don't make it

Upvotes: 0

Views: 464

Answers (2)

Harshad Hirapara
Harshad Hirapara

Reputation: 462

Try This

 var str = 'a/b/c';

    var replaced = str.replace('\', ' ');

    var replaced = str.replace(/ /g, ' ');

Upvotes: 0

Pavlos Katsonis
Pavlos Katsonis

Reputation: 80

Backslashes have to be escaped. If you are looking for a string that starts with 2 backslashes, use the following:

data[i].replace('\\\\10.10.12\\AxDocuments\\', '')

Upvotes: 1

Related Questions