Would you like a Snobol pattern matcher? (Re: Making regex suck less)
johnroth at ameritech.net
Tue Sep 3 18:20:57 EDT 2002
"Carl Banks" <imbosol at vt.edu> wrote in message
news:al30tq$aud$1 at solaris.cc.vt.edu...
> John Roth wrote:
> > I don't know much about Snobol, unfortunately.
> > I think my biggest issue here is that we shouldn't
> > reinvent the wheel unless there is a good reason.
> > In other words, Larry is taking Perl in a specific
> > direction. Assuming we want to make major
> > changes to regex,
> I don't think anyone wants to make changes to regular expressions, per
> se. I think this discussion is about adding a higher level syntax to
> regular expressions, that makes them more readable and versatile, for
> cases where that's important.
One of the things Perl has right now is the ability to use spaces
within regular expressions via a suffix flag. In Perl 6, this will
standard, and will include the ability to include comments!
Apocalypse 5 is well worth reading. Larry sets out why he
decided to redesign regular expression syntax. Much of the
reason was exactly what you specify: it's hard to read, hard
to understand, and has picked up lots of cruft over the years.
Making regular expressions "more versatile" is a great
idea. There's lots of things I'd like to do. However,
everything you load onto the poor thing makes it that
much more complex, hard to understand, hard to read
and errorprone. At some point, the mess has to be
redesigned. Since Python's re syntax isn't currently
as complex as Perl's (I think) it might not be there yet.
> > is there any _good_ reason
> > for doing something conceptually different and
> > consequently adding to the cacophony?
> I think there is a good reason to have a higher level syntax. It
> serves a purpose heretofore unserved: that complex regular expressions
> no longer have to be unbearably unreadable.
> I could live without it, though.
> CARL BANKS
More information about the Python-list