Must be a bug in the re module [was: Why this result with the re module]
lists at asd-group.com
Wed Nov 3 05:33:15 CET 2010
> OK, I've got that, and I have no problem with the capturing part.
> My real problem is with the number of total matches.
> *I think it should be 4 matches in total but findall
> gives 6 matches*, for the new regex '((.a.)*)*'.
> I'd love to know what you think about this.
> Many thanks!
We've already been through that, and nothing's changed - all you've done is:
1) taken something that you know (now!) has six matches:
2) added an outer capturing group (which does not change the actual
matches, only what gets returned):
3) then said there must be >=0 occurrences of what's inside it, which of
course there is, so that has no effect.
End result: the matching is exactly the same, findall still needs to
return the 6 things it did in the first place, but now it also has to
return an extra value at each return location (that being what's
captured by the new outer group) hence the tuples.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list