62,614
社区成员
发帖
与我相关
我的任务
分享
select("img[src~=(?i)\.(gif|png|jpe?g)]");
select("a[href~=(?i)\.(gif|png|jpe?g)]");
Document doc = Jsoup.parse(...);
Elements nodes = doc.select("img");
for(Element node : nodes){
System.out.println(node.attr("src"));
}
<a href="..........jpg"/> 这种你看Jsoup的文档,里面有这类型的选择器。
String s = "\"http://www.baidu.com/it/ddf=3424.jpg\"";
Pattern p = Pattern.compile("[\"\'](http.+\\.(jpg|gif|png))[\"\']");
Matcher m = p.matcher(s);
while(m.find()) {
System.out.println(m.group(1));
}