Replace all backslashes in a string with a pipe

后端 未结 2 1576
不知归路
不知归路 2020-12-06 04:48

I have the string: \\rnosapmdwq\\salesforce\\R3Q\\OutputFiles\\Archive

I\'m getting a unrecognized escape sequence when I try to send this to a .NET web service.

2条回答
  •  [愿得一人]
    2020-12-06 05:12

    The correct syntax would be: Path = Path.replace(/\\/g, "|");

    Working example at: http://jsfiddle.net/eDKej/.

    Example (extra code for demonstration purposes only):

    var Path = $("#path").text();
    Path  = Path.replace(/\\/g, "|");
    $("#new-path").append(Path);
    

提交回复
热议问题