Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have the string: nosapmdwqsalesforceR3QOutputFilesArchive

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

I'm trying to replace all of the "" with "|" to send it to the server.

I know I can use the replace method but that only replaces the first element. I think I need to use a regular expression to solve it.

Here's what I have so far:

Path = Path.replace("\/g", "|");

This is wrong though.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
313 views
Welcome To Ask or Share your Answers For Others

1 Answer

You don't need to make a regex a string, and it helps having that first / in there

Path = Path.replace(/\/g, "|")

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...