过滤指定的HTML标签

public static string NoHTML(string html)
{
string[] strArray2 = new string[] { "font", "span", "div", "p" };
foreach (string str in strArray2)
{
string pattern = string.Format("</?{0}[^>]*?>", str);
html = Regex.Replace(html, pattern, "", RegexOptions.IgnoreCase);
html = html.Replace("&nbsp;", " ");
}
return html;
}

 

 

posted @ 2013-04-06 16:04  哥,我还要  阅读(288)  评论(0编辑  收藏  举报