zoukankan      html  css  js  c++  java
  • matcher.matches() 完全匹配 matcher.find() Pattern匹配

    import java.util.regex.*
    System.properties.putAll( ["http.proxyHost":"10.10.224.97", "http.proxyPort":"80","http.proxyUserName":"admin", "http.proxyPassword":"admin888"] )

    def url="http://detail.tmall.com/item.htm?id=8039043384&"
    url="http://www.baidu.com"
    //html=url.toURL().text
    //def matcher=( html=~ /<strong id="J_StrPrice"/ )
    //println matcher
    def html='''zzzzzz<strong id="J_StrPrice" >3399.00</strong>zzzz'''

    html='''3333aaa'''

    def matcher = html =~ /\d{4}/

    println matcher.find()











    println "==============================="



    //println html
    //def matcher = ( html =~ /<strong id="J_StrPrice" >([\s\S])*?<\/strong>/ )

    println matcher.getCount()
    println matcher.matches()
    if (matcher.matches())
    {
    println matcher

    }
    else
    {
    println "xxxz"
    }

  • 相关阅读:
    线段树优化dp(elect选择)
    gdb调试
    无参装饰器
    3.23作业
    3.22周末作业
    函数对象与闭包函数
    3.20作业
    3.19作业
    名称空间与作用域
    函数参数的使用
  • 原文地址:https://www.cnblogs.com/lexus/p/2568424.html
Copyright © 2011-2022 走看看