Test, validate and match regular expressions
Matches simple pretty-printed XML elements where an opening tag, its content, and the closing tag each sit on separate lines. The tag name is captured in the named group 'tag1', and a backreference (?P=tag1) ensures the closing tag matches the opening one, while 'tag2' captures the inner content. With global and multiline flags, it's useful for parsing, validating, or reformatting line-based XML documents.