/// <summary>移除 HTML 标签、样式标签及内容、脚本标签及内容和空格</summary> /// <param name="html">要处理的 HTML 内容</param> /// <returns>移除后的内容</returns> public static string RemoveHtml(this string html) { if (html.IsNullOrEmpty_()) { return(string.Empty); } string _html = Regex.Replace(html, STR.Concat(@"<style.*?>.*?</style>|<script.*?>.*?</script>|<.*?>|\s| | |", Separator.PageBreak, "|", Separator.PageTitle), " ", RegexOptions.IgnoreCase | RegexOptions.Compiled); return(Regex.Replace(_html, " +?", " ", RegexOptions.Compiled)); }