public static void main(String[] args) { String regex = "<\\s*img(.+?)src=[\"'](.*?)[\"']\\s*/?\\s*>"; Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE); String content = "<img width=\"450\" height=\"610\" alt=\"\" src=\"/data/attachment/editor/201307040924448645.jpg\" />"; Matcher matcher = pattern.matcher(content); while (matcher.find()) { String group0 = matcher.group(0); String group1 = matcher.group(2);
System.out.println(group0);
System.out.println(group2);
} }