• 去除html标签、css以及script


    public static string ConvertHtml2String(string html)
            {
                html = html.Trim();
                html = Regex.Replace(html, "(\<script(.+?)\</script\>)|(\<style(.+?)\</style\>)", "", RegexOptions.IgnoreCase | RegexOptions.Singleline);//去除css和script
                html = Regex.Replace(html, "<[^>]+>", "");//去除html标签
                html = Regex.Replace(html, "&[^;]+;", "");//去除html空格,类似&nbsp;,https://blog.csdn.net/weixin_42105932/article/details/80234320
                html = Regex.Replace(html, "	", "");//去除换行、空格、制表符等
                html = Regex.Replace(html, "
    ", "");
                html = Regex.Replace(html, "
    ", "");
                html = Regex.Replace(html, "
    ", "");
                html = Regex.Replace(html, " ", "");
                return html;
            }
  • 相关阅读:
    算法市场 Algorithmia
    Cucumber
    TeamCity 持续集成工具
    自动化测试
    Selenium
    Android耗时操作
    RecyclerView
    Android报错
    Lakeshore
    BaaS_后端即服务 RESTful
  • 原文地址:https://www.cnblogs.com/MarcLiu/p/13517313.html
Copyright © 2020-2023  润新知