去除html标签 正则表达式
/// <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;
}
}
独身中...彼女を募集してる。。