usingSystem.Text.RegularExpressions;//包含正则表达式
publicstaticstringNoHTML(stringHtmlstring)//去除HTML标记
{
//删除脚本
Htmlstring = Regex.Replace(Htmlstring, @””,””, RegexOptions.IgnoreCase);
//删除HTML
Htmlstring = Regex.Replace(Htmlstring, @”]*)>”,””, RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @”([\r\n])[\s]+”,””, RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @”–>”,””, RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @””, “”, RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @””,
@””,
@”