[Python-Dev] sre improvements

Greg Ward gward@python.net
Thu, 14 Jun 2001 16:11:49 -0400


On 14 June 2001, Paul Prescod said:
> I would rather see us try a new approach to regular expressions. I've
> seen a few proposals for more verbose-but-readable syntaxes. I think one
> was from Greg Ewing? And maybe one from Ping? 

I remember Ping's from a few year's back.  It was pretty cool, but
awfully verbose.  I *like* the compactness of the One True Regex
Language (ie. the one implemented by Perl 5, PCRE, and SRE).

> For those of us who use regular expressions only once in a while (i.e.
> the lucky ones), the current syntax is a holy terror. Which characters
> are magical again? In what contexts? With how many levels of
> backslashing? Upper case W versus lower case W?

Wow, you should try keeping grep vs. egrep vs. sed vs. awk (which
version again?) vs. emacs straight.  I generally don't bother: as soon
as a problem gets too hairy for grep/sed/awk/etc., I whip out my trusty
old friend "perl -e" and all is well again.  Unless I'm already coding
in Python of course, in which case I whip out my trusty old friend
re.compile(), and everything just works.  I guess I just have a good
memory for line noise.

> Obviously we can never abandon the tried and true Perl5 RE module, but I
> think we could have another syntax on top.

Yeah, I s'pose it could be useful.  Yet another great teaching tool, at
any rate.

        Greg
-- 
Greg Ward - Python bigot                                gward@python.net
http://starship.python.net/~gward/
Quick!!  Act as if nothing has happened!