[relaxng-user] Latest proposal for smart regexes in RELAX NG

David Tolpin dvd at davidashen.net
Thu May 6 23:05:33 ICT 2004


> > This is just an example of bad use of regular expressions, nothing
> > else. 
> 
> Not at all.  It's a regex for matching RFC 822 valid email
> addresses.  And of course I cheated: he built it up out of
> smaller pieces.  The actual Perl code that does the work is at
> http://public.yahoo.com/~jfriedl/regex/email-opt.pl .

Yes, I remember it. And a few months back, we had discussed the
very same example, and this is not a Unicode regular expression,
and this is not posix syntax; this is crappy perl extensions
used inappropriately just to show that regexps can be long.

A W3C XML Schema regexp for the very same production is 136
characters long.

> > Besides, it is just one more proof that string regular expressions
> > is a powerful tool, not every language can make a statement like
> > this.
> 
> But, of course, it's neither intelligible nor debuggable.

As I've just said, it's  an example specifically made to show
that regular expressions can be written to become neither intelligible
nor debuggable, the example above is of no practical use. It's just
a joke. Or a poor taste. A normal regular expression for exactly
the same domain is less than two lines.
> 
> > And in normal use of Unicode regexps, please. Let's which
> > one will be shorter and easier to use. 
> 
> The point is that string regexes are so difficult that we can't in
> practice make more than trivial use of them.  That sacrifices their
> great power.
> 

I used strings regular expressions in numerous non-trivial cases.

Who are 'we'? 

How XMLizing helps use them? 

Examples, please.

David


More information about the relaxng-user mailing list