sre negated lookaheads/behinds

Fredrik Lundh effbot at telia.com
Fri Oct 20 16:15:39 EDT 2000


Andrew wrote:
> Robin Becker <robin at jessikat.fsnet.co.uk> writes:
> > Clearly my a( is not preceded by self. in either case. However, in the
> > first case as there is not enough room for the positive look behind I
> > think it is wrongly failing to match. Is this correct?
>
> I think you've found a bug.  (First bug found in 2.0?) The ASSERT_NOT
> opcode contains this bit of code:
>      if (state->ptr < state->beginning)
>                  return 0;
>
> I think this is wrong; if the pattern is too long to match, then
> clearly the negative lookbehind succeeds, so it should simply continue
> matching the rest of the pattern.  Patch #101972 on SourceForge is a
> proposed fix; /F has to approve it first.

you're right, of course; negative lookbehind is clearly broken
in 2.0.  my fault (shouldn't have let you add it to the docs ;-)

sorry /F





More information about the Python-list mailing list