PyWart: Python regular expression syntax is not intuitive.

Duncan Booth duncan.booth at invalid.invalid
Wed Jan 25 14:32:18 EST 2012

Rick Johnson <rantingrickjohnson at> wrote:

> (?...)  # Base Extension Syntax
> All extensions are wrapped in parenthesis and start with a question
> mark, but i believe the question mark was a very bad choice, since the
> question mark is already specific to "zero or one repetitions of
> preceding RE". This simple error is why i believe Python re's are so
> damn difficult to eyeball parse. You'll constantly be forced to spend
> too much time deciding if this question mark is a referring to
> repeats, or is the start of an extension syntax. We should have
> choosen another char, and the char should NOT be known to RE in any
> other place. Maybe the tilde would work? Wait, i have a MUCH better
> idea!!!

The problem with your idea is that it breaks compatability with other non-
Python regular expression engines. Python didn't invent the (?...) syntax, 
it originated with Perl.

Try complaining to a Perl group instead.

Duncan Booth

More information about the Python-list mailing list