zoukankan      html  css  js  c++  java
  • 正则表达式获取TABLE里的内容

    //过滤  转换成空
                String withoutNString=message.Replace(" ", "");
                //过滤  转换成空
                String withoutRString = withoutNString.Replace(" ", "");
                //过滤  转换成空
                String withoutTString = withoutRString.Replace(" ", "");
                //过滤 转换成空
                String newString = withoutTString.Replace("\", "");
                //获取html中的body标签
                String result = Regex.Match(newString, @"<body.*>.*</body>").ToString();
                //过滤注释
                String result2 = Regex.Replace(result, @"<!--(?s).*?-->", "", RegexOptions.IgnoreCase);
                //过滤nbsp标签
                String result3 = Regex.Replace(result2, @"&nbsp;", "", RegexOptions.IgnoreCase);
                //获取body中的所有table
                Regex regex = new Regex(@"<table.*?>[sS]*?</table>");
                MatchCollection mc = regex.Matches(result3);
                //获取集合类中自己需要的某个table
                String newHtmlStr = mc[3].ToString();

  • 相关阅读:
    获取指定位置的颜色值
    《QTP自动化测试进阶》读书笔记
    Delphi自动化测试
    QTP中DOM的递归调用取html页面值
    PowerShell
    Dictionary对象与XML文件之间的导入导出
    BPT业务流程自动化测试
    VisualStudio 自动化测试框架 Coded UI Test
    使用QTP查找邮件
    QTP11视频
  • 原文地址:https://www.cnblogs.com/XuPengLB/p/5856226.html
Copyright © 2011-2022 走看看