去除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;
            }
        }

去除html标签 正则表达式,布布扣,bubuko.com

去除html标签 正则表达式

上一篇:分享29个超赞的响应式Web设计


下一篇:css初始化代码方案