Replace backslash with double backslash using Regex
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]
4 Answers
Know the answer? Post it. Somebody with the same question will find it here.

uzir39 reputationPosted Jan 10, 2004, 2:24 AM EST
mmilligan5 reputationPosted Jan 10, 2004, 4:30 PM EST
uzir39 reputationPosted Jan 12, 2004, 3:31 AM EST
uzir39 reputationPosted Jan 12, 2004, 3:32 AM EST