I want to replace backslash => '\' with secure
el = el.replace(/\#/g, '#'); // replaces all '#' //that's cool
el = el.replace(/\\/g, '\'); // replaces all '\' //that's failing
open console and type
fails because the slash in the string isn't really in the string, it's escaping '
works because it takes one slash and finds it.
your regex works.