RE question
Michael Hudson
mwh21 at cam.ac.uk
Tue Apr 18 09:52:27 EDT 2000
Benyang Tang <btang at pacific.jpl.nasa.gov> writes:
> >>> m = re.match("([abc])+", "abc"); m.group(1)
> 'c'
>
> Why is it 'c', instead of 'a'?
On
http://www.python.org/doc/current/lib/match-objects.html
we find:
If a group is contained in a part of the pattern that matched
multiple times, the last match is returned.
So that's why.
Cheers,
M.
--
nonono, while we're making wild conjectures about the behavior
of completely irrelevant tasks, we must not also make serious
mistakes, or the data might suddenly become statistically valid.
-- Erik Naggum, comp.lang.lisp
More information about the Python-list
mailing list