可以扩展很多,也可以用此方法做采集信息,
fck("过滤的字符串", @"<font color=""#ff0000"">.*?</font>", @"<font color=""#ff0000"">", @"</font>")
public string fck(string htmls, string pattern, string patternstart, string patternend)
{
Regex regex = new Regex(@pattern, RegexOptions.IgnoreCase);
MatchCollection mc = regex.Matches(htmls);
string htmlreplace = string.Empty;
foreach (Match m in mc)
{
if (m.Success)
{
htmlreplace = m.Value.Replace(patternstart, "");
htmlreplace = htmlreplace.Replace(patternend, "");
htmls = htmls.Replace(m.Value, htmlreplace);
}
}
return htmls;
}