How to globally replace a forward slash in a JavaScript string?
Is this what you want?
'string with / in it'.replace(/\//g, '\\');