Making regex suck less

Carl Banks imbosol at
Mon Sep 2 19:34:29 EDT 2002

John La Rooy wrote:
> Carl Banks wrote:
>>>or would you like to suggest something else?
>> How about:
>> pattern = Group(Any()) + Group(Any()) + Group(Any()) \
>>           + GroupRef(3) + GroupRef(2) + GroupRef(1)
> Err symantically that's exactly the same as the re and my suggestion
> only the syntax is different. It's still nothing like saying
> pattern = "6 character palindrome"

Oh.  Well, methinks you don't give humans enough credit.  I'm a human,
and I can read the verbose regexp.  Of course, humans can read regular
expressions, too.  Maybe I don't give humans enough credit, either.

The point is, I was arguing for less-cryptic, more-verbose regular
expressions as a way to make complicated patterns more transparent.  I
certainly wasn't arguing for "6 character palindrome".

Sorry-for-the-confusion-ly y'rs


More information about the Python-list mailing list