leftmost longest match (of disjunctions) ; greediness of "|"

Padraig at Linux.ie Padraig at Linux.ie
Tue Dec 2 05:40:24 EST 2003


Joerg Schuster wrote:
> Peter Hansen <peter at engcorp.com> writes:
> 
> 
>>produce a longer overall match.  In other words, the "|" operator is never 
>>greedy. 
> 
> 
> O.k. Thanks for pointing this out. Maybe I should have formulated my
> question differently: Is there a trick (be it dirty or not) to make
> "|" greedy in python?

sort the re by size first?

Pádraig.





More information about the Python-list mailing list