On 03/11/2010 06:32, Yingjie Lan wrote:
--- On Wed, 11/3/10, John Bond<li...@asd-group.com>  wrote:
I just explained that (I think!)! The outer capturing group
uses
repetition, so it returns the last thing that was matched
by the inner
group, which was an empty string.

According to yourself, the last match of the
inner group is also empty!

Generally speaking,
as a match for the outer group always
contains some matches for the inner group,
it must be the case that the last match
for the inner group must be contained
inside the last match of the outer group.
So if the last match of the
outer group is empty, then the last
match for the inner group must
also be empty.

[snip]
The outer group is repeated, so it can match again, but the inner group
can't match again because it captured all it could the previous time.

Therefore the outer group matches and captures an empty string and the
inner group remembers its last capture.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to