用自己转义自己。C#字符串前加@ at 时,正则转义双引号的方法。
Regex reg= new Regex("(?<=<td align=\"center\" style=\"white-space:nowrap;\">)[\\s\\S]*?(?=</td>)", RegexOptions.IgnoreCase);
Regex reg= new Regex(@"(?<=<td align=""center"" style=""white-space:nowrap;"">)[\s\S]*?(?=</td>)", RegexOptions.IgnoreCase);
这跟string.Format转义大括号“{”是类似的。用自己转义自己。
//比如想要输出---{cozof}--- string str = string.Format("---{{0}}---", "cozof");
3.