[Python-Dev] one last SRE headache
Fredrik Lundh
Fredrik Lundh" <effbot@telia.com
Thu, 31 Aug 2000 21:46:54 +0200
can anyone tell me how Perl treats this pattern?
r'((((((((((a))))))))))\41'
in SRE, this is currently a couple of nested groups, surrounding
a single literal, followed by a back reference to the fourth group,
followed by a literal "1" (since there are less than 41 groups)
in PRE, it turns out that this is a syntax error; there's no group 41.
however, this test appears in the test suite under the section "all
test from perl", but they're commented out:
# Python does not have the same rules for \\41 so this is a syntax error
# ('((((((((((a))))))))))\\41', 'aa', FAIL),
# ('((((((((((a))))))))))\\41', 'a!', SUCCEED, 'found', 'a!'),
if I understand this correctly, Perl treats as an *octal* escape
(chr(041) == "!").
now, should I emulate PRE, Perl, or leave it as it is...
</F>
PS. in case anyone wondered why I haven't seen this before, it's
because I just discovered that the test suite masks syntax errors
under some circumstances...