文本框&$$$loginName&$$$用户名|$$$密码框&$$$userPassword&$$$密码|$$$登录按钮&$$$http://192.168.10.251:8080/app/login.do?realmId=1330504872002&$$$登陆url要从中得到http://192.168.10.251:8080/app/login.do?realmId=1330504872002求正则~tks

解决方案 »

  1.   

    文本框&$$$loginName&$$$用户名|$$$密码框&$$$userPassword&$$$密码|$$$登录按钮&$$$http://192.168.10.251:8080/app/login.do?realmId=1330504872002&$$$登陆url以上是整个字符串信息,从中刷选
      

  2.   


    public static void main(String[] args) {
    String str = "文本框&$$$loginName&$$$用户名|$$$密码框&$$$userPassword&$$$密码|$$$登录按钮&$$$http://192.168.10.251:8080/app/login.do?realmId=1330504872002&$$$登陆url";
    Pattern pattern = Pattern.compile("h.*2");
    Matcher matcher = pattern.matcher(str);
    if (matcher.find()) {
    System.out.println(matcher.group());
    }
    }
      

  3.   

    (?=\\&) 和 (?<=\\$\\$\\$) 这两个表达式谁来解释下~
      

  4.   

    (?=\\&)要匹配的字符串要在&之前
    (?<=\\$\\$\\$) 要匹配的字符串要在$$$之后,\\是转义
      

  5.   

    (?=\\&)要匹配的字符串要在&之前
    (?<=\\$\\$\\$) 要匹配的字符串要在$$$之后,\\是转义惭愧。。零宽断言写的少,乍一看愣是没明白。。
    自己也写了一下:
    (?<=&\$\$\$)http://.+(?=&\$\$\$)
      

  6.   

    (?=\\&)要匹配的字符串要在&之前
    (?<=\\$\\$\\$) 要匹配的字符串要在$$$之后,\\是转义惭愧。。零宽断言写的少,乍一看愣是没明白。。
    自己也写了一下:
    (?<=&\$\$\$)http://.+(?=&\$\$\$)几乎要忘记零宽断言了,咳。。