3 个解决方案
#1
string input = @"\\x00\\x00\\x00\\x00\\xaa\\x8f\\x63\\x3b";
System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(
@"\\(\\x[0-9a-f]{2})",
System.Text.RegularExpressions.RegexOptions.IgnoreCase
);
string output = reg.Replace(input,"$1");
#2
input.Replace("\\\\", "\\");
#3
string s = @"\\x00\\x00\\x00\\x00\\xaa\\x8f\\x63\\x3b";
string r = s.Replace(@"\\x", @"\x");
Console.Write(r);
Console.ReadKey();
#1
string input = @"\\x00\\x00\\x00\\x00\\xaa\\x8f\\x63\\x3b";
System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(
@"\\(\\x[0-9a-f]{2})",
System.Text.RegularExpressions.RegexOptions.IgnoreCase
);
string output = reg.Replace(input,"$1");
#2
input.Replace("\\\\", "\\");
#3
string s = @"\\x00\\x00\\x00\\x00\\xaa\\x8f\\x63\\x3b";
string r = s.Replace(@"\\x", @"\x");
Console.Write(r);
Console.ReadKey();