日期:2014-05-17 浏览次数:20675 次
String html="<li class=\"unit\"><a href=\"/ilist/list\" class=\"t\" boss=\"btnViewMyList\" rel=\"http://1.t.qq.com/asyn/list.php\" type=\"list\"><span class=\"text\">名单</span></a></li>"; Pattern p = Pattern.compile("<a\\s.*?href=\"([^\"]*)(.*?)</a>", Pattern.CASE_INSENSITIVE); Matcher m = p.matcher(html); while (m.find()) { if (m.group(2).indexOf("名单")>= 0) { System.out.println("HREF: " + m.group(1) + "\t\tWITH: " + m.group(2)); } }