How best can I convert instances of double backslashes to a single backslash in a string, but remove any occurrences of single backslash?
So this:
\|Testing|ABC:1234\\1000-1\|
Should convert to this:
|Testing|ABC:1234\1000-1|
Ideally I want to avoid a temporary replace of '\' to another character. A solution using .NET or Regular Expressions is preferred.
Regex.Replace(input, @"\\(.|$)", "$1");
[Edit: Pattern didn't match all possible cases specified in the OP. Thanks for the suggestions, GONeale and Alan M.]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With