Skip to main content

Module pattern

Module pattern 

Source
Expand description

A small regular-expression engine for xs:pattern.

XSD patterns are a dialect of their own: they are always anchored, they have no capture groups, and they add character-class escapes that Perl-style engines spell differently. Rather than pull in a full regex crate and then have to explain which parts of it do not apply, this implements the subset XSD actually defines.

Supported: literals, ., character classes with ranges and negation, the escapes \d \D \w \W \s \S, groups, alternation, and the quantifiers ? * + and {n} {n,} {n,m}.

Matching is backtracking. Patterns in schemas are small and applied to short values, so the simplicity is worth more than the worst-case guarantee an NFA construction would give.

Structsยง

Pattern
A compiled xs:pattern.
PatternError
Why a pattern could not be compiled.