日期:2014-05-20 浏览次数:20548 次
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Hello {
public static void main(String[] args) throws Exception {
String str =
"<img src=\\\"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAOijjEUYRScD1ooooA//Z\\\"><img src=\\\"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAOijjEUYRScD1ooooA//Z\\\">"
;
String patternString = "<img src=\\\\\"data:image/(.+?)\">";
Pattern pattern = Pattern.compile(patternString);
Matcher matcher = pattern.matcher(str);
while (matcher.find()) {
System.out.println(matcher.group(1));
}
}
}
jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAOijjEUYRScD1ooooA//Z\
jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAOijjEUYRScD1ooooA//Z\