Use an HTML parser. NOT regular expressions. The problem with regular expressions is that they cannot match nested structures. Assuming your regex must match a single <div> and its closing tag, there is no way to correctly match this input:
Attention in classroom
Use an HTML parser. NOT regular expressions. The problem with regular expressions is that they cannot match nested structures. Assuming your regex must match a single <div> and its closing tag, there is no way to correctly match this input: