Test, validate and match regular expressions
Matches XWiki heading lines, capturing the heading level (one or more '=' signs) in group 1 and the title text in group 2, while tolerating optional leading/trailing whitespace and closing '=' markers. With the gm flags it processes each line independently, making it ideal for beautifying or normalizing XWiki heading syntax like '= My Title ='. The [^\S\r\n] construct matches horizontal whitespace only (spaces/tabs), ensuring matching never crosses line boundaries.