首页 > 代码库 > 过滤HTML

过滤HTML

过滤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;
}