[relaxng-user] Latest proposal for smart regexes in RELAX NG
Bob Foster
bob at objfac.com
Tue May 4 22:57:09 ICT 2004
jcowan at reutershealth.com wrote:
> ...it would be nice to have a better regular expression
> facility than the WXS pattern facet, which uses quite limited regular
> expressions, written in a messy hard-to-use code that has nothing to
> do with the rest of WXS *or* RNG, and has no facility for building up
> patterns from pieces of other patterns.
>
> The design I posted is:
>
> 1) cleanly embeddable into RNG, sharing its naming conventions when possible
> 2) uses elements in the rx: namespace to express the components of
> regular expressions
> 3) allows references with rx:ref to sub-regexes defined within
> ordinary rng:define elements.
> 4) implementable using an ordinary Posix regex engine
Yes, this would be a good thing, and my comment is in no way intended as
a criticism, but why stop at regex? Why not use the more powerfully
expressive Parsing Expression Grammars (PEG)? This would allow you to
describe mini-languages as powerful as XPath, regex itself, XQuery,
structured data formats, even the compact syntax. Another plus would be
that PEG grammars are a good deal easier to read (and with suitable
training, write) than regexen. Just a thought.
Bob Foster
More information about the relaxng-user
mailing list