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

原文地址:https://www.cnblogs.com/huhaihua/p/3656751.html