Simple code, in node v.9.30 i can not replace all occurrences of '\' to get string "n_fdsan__xsa". Should I use different approach?
s = 'n\fdsan\\xsa';
r = s.replace(/\\\\/g, "_");
console.log(r);
EDIT: Thanks to @Quentin and @Phillip, I realized that '\f' is different char - form feed and second one is really backslash - '\'.
s = 'n\fdsan\\xsa';
r = s.replace(/\\/g, "_");
console.log(r);
// Displays:
n
dsan_xsa