zoukankan      html  css  js  c++  java
  • 截取html中的某个节点

    String content = "<meta property="og:description" content="freeCodeCamp Earth &#x6709; 127,712 &#x4f4d;&#x6210;&#x54e1;&#x3002; Welcome to freeCodeCamp Earth!
    " +
                    "
    " +
                    "This is a relaxing place to discuss coding and share your accomplishments.
    " +
                    "
    " +
                    "To keep this Facebook group civil, our moderator team..." />
    " +
                    "	<meta property="og:url" content="https://www.facebook.com/groups/321090721625587/" />
    " +
                    "	<meta property="og:locale" content="en_US" />";
            String readText = "";
    //        Pattern p = Pattern.compile("<div\s*class=["']mail-trace["'](.*)>(.*)<\/div>");
            Pattern p = Pattern.compile("<meta\s*property=["']og:url["'](.*)(.*)\/>");
            Matcher matcher = p.matcher(content);
            if (matcher.find()) {
                for (int i = 0; i <= matcher.groupCount() && StringUtils.isEmpty(readText); i++) {
                    readText += matcher.group(i);
                }
            }
            System.out.println(readText);
    <meta property="og:description" content="freeCodeCamp Earth &#x6709; 127,712 &#x4f4d;&#x6210;&#x54e1;&#x3002; Welcome to freeCodeCamp Earth!
    
    This is a relaxing place to discuss coding and share your accomplishments.
    
    To keep this Facebook group civil, our moderator team..." />
        <meta property="og:url" content="https://www.facebook.com/groups/321090721625587/" />     要匹配内容!
        <meta property="og:locale" content="en_US" />
  • 相关阅读:
    POJ_1456 Supermarket 【并查集/贪心】
    CSS before和after伪类
    CSS anchor专为链接属性选择器
    CSS 属性选择器
    CSS float浮动
    CSS 外边距和内填充
    CSS 边框属性
    CSS 背景
    CSS 组和选择器
    CSS 引入方式
  • 原文地址:https://www.cnblogs.com/wanhua-wu/p/13638366.html
Copyright © 2011-2022 走看看