日期:2014-05-20 浏览次数:20660 次
public static void main(String[] arg) {
List<String> imgList = new ArrayList<String>();
String intputStr = "<img id=\"_aimg_177170\" aid=\"177170\" zoomfile=\"http://img.xyzd.cn/forum/201305/27/102057clk5q332dddlcz3c.jpg\" src=\"http://img.xyzd.cn/forum/201305/27/102057clk5q332dddlcz3c.jpg\" class=\"zoom\" onclick=\"zoom(this, this.src, 0, 0, 1)\" width=\"600\" alt=\"图标7副本.jpg\" "
+ "title=\"图标7副本.jpg\" w=\"600\"><br><img id=\"_aimg_177075\" aid=\"177075\""
+ " zoomfile=\"http://img.xyzd.cn/forum/201305/27/094713r0ssmrmjrrrdjpds.jpg\" src=\"http://img.xyzd.cn/forum/201305/27/094713r0ssmrmjrrrdjpds.jpg\" "
+ "class=\"zoom\" onclick=\"zoom(this, this.src, 0, 0, 1)\" width=\"600\" alt=\"_MG_1320.JPG\" title=\"_MG_1320.JPG\" w=\"600\"><br>";
Pattern pattern = Pattern.compile("zoomfile=.+?(.jpg
------解决方案--------------------
.png
------解决方案--------------------
.gif)");
Matcher matcher = pattern.matcher(intputStr);
while (matcher.find()) {
imgList.add(matcher.group(0));
}
System.out.println(imgList);
}
run:
[zoomfile="http://img.xyzd.cn/forum/201305/27/102057clk5q332dddlcz3c.jpg, zoomfile="http://img.xyzd.cn/forum/201305/27/094713r0ssmrmjrrrdjpds.jpg]
成功构建 (总时间: 0 秒)