去除字符串中的html标记

正则表达式匹配下html标记
 public static string DeleteHTMLElement(string html)
        {
            html = Regex.Replace(html, "<[^>]*>{1}", "", RegexOptions.IgnoreCase);
            html = html.Replace("\n", " ");
            html = html.Replace("\t", " ");
            html = html.Replace("\r", " ");
            html = html.Replace("&nbsp ", " ");
            html = html.Replace("&quot", " ");
            return Regex.Replace(html, " \\s{2,}", " ");
        }


 

猜你喜欢

转载自blog.csdn.net/hjingtao/article/details/8003115
今日推荐