I've got a code which treat String as a one tag and extract everything together. In this case: "abc</a> <a>def". How to extract from tags separatedly to obtain two Strings: "abc" and "def"?
public static void main(String[] args) throws Exception {
Ex.findInTags("<a>((.*))</a>", "<a>abc</a> <a>def</a>");
}
public static void findInTags(String a, String b) {
Pattern pattern = Pattern.compile(a);
Matcher matcher = pattern.matcher(b);
if (matcher.find()) {
System.out.println(matcher.group(1));
}
}