2

I'm trying:

var str = "\\\\user-nb\\d$\\temp\\tmp1\\teste.TAR";
str = str.replace(/\\"/g,'&'); 

But it doesn't work ... Any help please? Thx all

Igor Dymov
  • 16,230
  • 5
  • 50
  • 56
  • 2
    There's several questions already answered on this, e.g. [this one](http://stackoverflow.com/questions/1144783/replacing-all-occurrences-of-a-string-in-javascript), maybe they don't answer explicitly your question, but please take a look. Also [this link about regular expressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Using_Special_Characters) may be useful. – lrnzcig Oct 30 '15 at 11:59

1 Answers1

3

Currently you are trying to replace all quotes. You want to replace all backslashes?

str.replace(/\\/g,'&');
misantronic
  • 1,132
  • 2
  • 10
  • 23