4
Answers

Replace backslash with double backslash using Regex

mmilligan

mmilligan

20y
15.9k
1
I want to replace single back slashes in a string with double back slashes. This is for a database string I pass into an API method call. The following causes a run-time error: public static string setDoubleFSlash(string sPath) { return Regex.Replace(sPath,"\\","\\\\"); } Now I use an extra back slash to escape the actual back slash. HELP! [email protected]
Answers (4)