fn translate(xsd: &str) -> StringExpand description
Rewrite an XSD pattern as an equivalent Rust regex.
Two differences matter. An XSD pattern has to match the value entire, so the
result is anchored. And XSD’s regex grammar has no anchors at all, which
makes ^ and $ ordinary characters there and metacharacters here, so they
are escaped. Everything the published catalog uses beyond that — classes,
bounded repetition, alternation, \d and its relatives — means the same in
both languages.
What is left untranslated is XSD’s character-class subtraction, [a-z-[aeiou]],
and its \i and \c shorthands for XML name characters. None appears in the
published catalog. One that did would fail to compile and be reported as
unchecked rather than quietly matching everything.