代码如下:
String content = "<p>下载地址:<a title=\"持续更新补丁下载地址\" target=\"_blank\" href=\"http://pan.baidu.com/s/xxxx\">持续更新补丁下载地址</a></p><p>";
Pattern pattern_a = compile("<a[^>]*href=(\\\"([^\\\"]*)\\\"|\\'([^\\']*)\\'|([^\\\\s>]*))[^>]*>(.*?)</a>");
Matcher matcher_a = pattern_a.matcher(content);
System.out.println("网站连接");
while (matcher_a.find()) {
for (int i = 0; i < matcher_a.groupCount(); i++) {
System.out.println(matcher_a.group(i));
}
}
输出结果如下:
<a title="持续更新补丁下载地址" target="_blank" href="http://pan.baidu.com/s/xxxx">持续更新补丁下载地址</a>
"http://pan.baidu.com/s/xxxx"
http://pan.baidu.com/s/xxxx
null
null
1568

被折叠的 条评论
为什么被折叠?



