日期:2014-05-19 浏览次数:20989 次
"<a\\s*href=\"/Patent/(\\d+)\"\\s*.+?>"
------解决方案--------------------
给你参考一下
public static void main(String[] args) { String pageContent = "<a href='/Patent/01127847' target='_blank'><a href='/Patent/01127821' target='_blank'><a href='/Patent/01127832' target='_blank'>"; Pattern pattern2 = Pattern.compile("<a\\s+href=.+?>"); Matcher matcher = pattern2.matcher(pageContent); while (matcher.find()) { String strPage = matcher.group(); System.out.println(strPage.replaceAll("(<a.+/|'\\s+.+>)", "")); } }
------解决方案--------------------
group(1)
------解决方案--------------------
Pattern pattern2 = Pattern.compile("(?:<a href='/Patent/(.*?)'\\s+target='_blank'>)");
然后group(1)