Making regex suck less

John La Rooy igetenoughspamalreadythanksjlr at doctor.com
Mon Sep 2 07:23:18 EDT 2002


Carl Banks wrote:

>>It would be more likely to look like this (I haven't put too much 
>>thought into this)
> 
> 
> No kidding.
> 
> 
> 
>>"anything,anything,anything,same_as_3rd,same_as_2nd,same_as_1st"
>>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"

John




More information about the Python-list mailing list