Test, validate and match regular expressions
Matches XML elements by capturing the tag name in a named group, then handling two forms: self-closing tags like <br/> or <img src="..."/>, and paired elements whose closing tag must match the opening tag via a backreference, capturing all nested children/content in between. Useful for parsing or extracting complete XML/HTML nodes along with their inner content.