On 9/25/07, Karthik Gurusamy <[EMAIL PROTECTED]> wrote:
>
> Any idea what this positive lookbehind achieves which can't be done
> without it.
> I remember cases where positive look-ahead is useful.
>
> In the above example, r.search('abcdef') does the job of ensuring
> 'def' is preceded by 'abc'.

AFAICT the only benefit I can see is that the lookbehind isn't
captured, so (a) it's not included in match.group(n), and (b)
match.start(), match.end(), and match.span() return the offsets of the
bit you actually wanted to capture.

OTOH, I often find the negative lookbehind (?!...) very useful indeed.

Andrew
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to