public class Homework {
public static void main (String[]args){
String a = "<div><h3>hello</h3></div><p><div>ok</div></p><div>hello333</div>";
Pattern s = Pattern.compile("<div>.*?</div>");
Matcher n = s.matcher(a);
while(n.find()){
System.out.println(n.group().replaceAll(".*<div>|</div>.*",""));
}
}
}