pub static XML_RE: LazyLock<Regex>Expand description
A lazily initialized regular expression that matches excess whitespace between XML/HTML tags.
This regex helps in cleaning up formatted or pretty-printed XML/HTML by removing unnecessary
spaces, newlines, or indentation between tags. It specifically looks for occurrences where
a > (closing tag or self-closing tag) is immediately followed by whitespace (spaces, tabs,
or newlines) and then a < (opening tag).
ยงNotes
- This regex is compiled once and reused, improving performance.
- The
multi_line(true)flag (if used withRegexBuilder) ensures it applies across multiple lines. - This is particularly useful for XML minification or normalization before processing.