[Python-Dev] one last SRE headache
Fredrik Lundh
Fredrik Lundh" <effbot@telia.com
Thu, 31 Aug 2000 22:33:11 +0200
guido wrote:
> Suggestion:
>
> If there are fewer than 3 digits, it's a group.
>
> If there are exactly 3 digits and you have 100 or more groups, it's a
> group -- too bad, you lose octal number support. Use \x. :-)
>
> If there are exactly 3 digits and you have at most 99 groups, it's an
> octal escape.
I had to add one rule:
If it starts with a zero, it's always an octal number.
Up to two more octal digits are accepted after the
leading zero.
but this still fails on this pattern:
r'(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)\119'
where the last part is supposed to be a reference to
group 11, followed by a literal '9'.
more ideas?
> (Can you even have more than 99 groups in SRE?)
yes -- the current limit is 100 groups. but that's an
artificial limit, and it should be removed.
</F>