Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex 如何删除“\'&引用;?_Regex_C# 4.0 - Fatal编程技术网

Regex 如何删除“\'&引用;?

Regex 如何删除“\'&引用;?,regex,c#-4.0,Regex,C# 4.0,我正在尝试从字符串中删除\' string temp = "[['90\'','','Delay in match Cédric Kanté (Sochaux) because of an injury.','away']]"; temp = Regex.Replace(temp, @"\\'", ""); >> still have ' mark [['90'','','...'] 我试过很多方法,但都失败了 谢谢您应该能够做到:.Replace(temp,@“\\”,

我正在尝试从字符串中删除
\'

 string temp = "[['90\'','','Delay in match Cédric Kanté (Sochaux) because of an injury.','away']]";

 temp = Regex.Replace(temp, @"\\'", "");  >> still have ' mark  [['90'','','...']
我试过很多方法,但都失败了


谢谢

您应该能够做到:
.Replace(temp,@“\\”,”)

它的格式可以由用户解析。不需要正则表达式

string temp = @"[['90\'','','Delay in match Cédric Kanté (Sochaux) because of an injury.','away']]";

var js = new JavaScriptSerializer();
List<List<string>> listOfList = js.Deserialize<List<List<string>>>(temp);

foreach (var item in listOfList[0])
    Console.WriteLine(item);
string temp=@“['90\'”,“因受伤而推迟比赛的塞德里克·坎特(索肖),“客场”]”;
var js=新的JavaScriptSerializer();
List listOfList=js.Deserialize(临时);
foreach(listOfList[0]中的变量项)
控制台写入线(项目);

@“\\”删除\但是,它仍然在那里。['90\'、'start delay'、'delay xxxx']、['23\''、'abcd'],我无法替换“”=>,因为在其他[]中有“”,您可以执行
。替换(临时,@“\\”,“”)