more than 100 capturing groups in a regex

Steven D'Aprano steve at REMOVETHIScyber.com.au
Tue Oct 25 08:41:01 EDT 2005


On Tue, 25 Oct 2005 05:17:52 -0700, Iain King wrote:

> 
> Fredrik Lundh wrote:
>> Joerg Schuster wrote:
>>
>> > I just want to use more than 100 capturing groups.
>>
>> define "more" (101, 200, 1000, 100000, ... ?)
>>
>> </F>
> 
> The Zero-One-Infinity Rule:
> 
> http://www.catb.org/~esr/jargon/html/Z/Zero-One-Infinity-Rule.html


Nice in principle, not always practical. Sometimes the choice is, "do you
want it today with arbitrary limits, or six months from now with bugs
but no limits?"

If assigning arbitrary limits prevents worse problems, well, then go for
the limit. For instance, anyone who has fought browser pops ups ("close
one window, and ten more open") may have wished that the browser
implemented an arbitrary limit of, say, ten pop ups. Or even zero :-)

Of course, having said that, in those cases, the limit isn't really
arbitrary. In cases of genuinely arbitrary limits, I agree they are
pointless and annoying (as opposed to having a point but still being
annoying).


-- 
Steven.




More information about the Python-list mailing list