[Python-Dev] one last SRE headache (original) (raw)

Fredrik Lundh Fredrik Lundh" <effbot@telia.com
Thu, 31 Aug 2000 22:08:23 +0200


amk wrote:

outside a character class it's a character if there are exactly 3 octal digits; otherwise it's a backref. So \41 is a backref to group 41, but \041 is the literal character ASCII 33.

so what's the right way to parse this?

read up to three digits, check if they're a valid octal number, and treat them as a decimal group number if not?