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 href='/Patent/([\\s\\S]*?)target='_blank'>)");
Matcher matcher = pattern2.matcher(pageContent);
while (matcher.find()) {
strPage = matcher.group();
}
要怎么样拿到01127847,01127821,01127832
上面哪里出错了
------解决方案--------------------------------------------------------
看不明白呀
------解决方案--------------------------------------------------------
- Java code
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='/Patent/([\\s\\S]*?)'\\s+target='_blank'>)"); Matcher matcher = pattern2.matcher(pageContent); while (matcher.find()) { System.out.println(matcher.group(1)); }