日期:2014-05-20 浏览次数:20816 次
String astr = "background=\"http://a.jpg,aa background=\"a.jpg,bb background=\"b.jpg\" ";
Pattern pattern = Pattern.compile("(background=\"(.*)\")");
Matcher matcher = pattern.matcher(astr);
String astr = "background=\"http://a.jpg\",aa background=\"a.jpg\",bb background=\"b.jpg\" ";
Pattern pattern = Pattern.compile("(background=\"(http://)?(.*?)\")");
Matcher matcher = pattern.matcher(astr);
List<String> str = new ArrayList<String>();
while (matcher.find())
str.add(matcher.group(3));
for (String s : str)
System.out.println(s);