/// <summary>
///
去除html标签
///
</summary>
public static
string ClearHtmlTag(string
strText)
{
try
{
string html =
strText;
html = Regex.Replace(html, @"<[^>]+/?>|</[^>]+>", "",
RegexOptions.IgnoreCase);
html = Regex.Replace(html, @"-->", "",
RegexOptions.IgnoreCase);
html = Regex.Replace(html, @"<!--.*", "",
RegexOptions.IgnoreCase);
html = Regex.Replace(html, @"&(nbsp|#160);", " ",
RegexOptions.IgnoreCase);
html = Regex.Replace(html, @"&#(\d+);", "",
RegexOptions.IgnoreCase);
return
html;
}
catch
{
return
strText;
}
}
原文:http://www.cnblogs.com/huhaihua/p/3656751.html