I need to replace all backslashes in a string with another symbol. I use regex for that, but it just doesn't work
const name = 'AC\DC';
const replaced = icon.replace(/\\/g, "-");
console.log(name);
console.log(replaced);
// ACDC
// ACDC
For example, in this string the backslash is not replaced and not even shown when I log the origial string in a console.
I get such strings from external source so I can't escape the backslash or use another character.