Test, validate and match regular expressions
This regex matches XML or HTML tags, capturing the tag name (group 1), attributes (group 2), and inner content (group 3). It handles both self-closing tags (<br/>) and paired tags (<div>content</div>), using a backreference to ensure the closing tag name matches the opening one. Commonly used for lightweight XML parsing, tag extraction, or simple validation, though it cannot handle nested tags of the same name.