Pythex.org is telling me I should be getting 5 matches, but I can't get more than 3 every which way I try. I have searched the internet, the documentation for both re and match objects, used help() I can't figure it out.
>>> z="this is x and this is x and also this is x and x x"
>>> m = re.search('(x+)',z)
>>> m.group(0,1)
('x', 'x')
>>> m.group(2)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: no such group
>>> m = re.search('(x)',z)
>>> m.group(0,1)
('x', 'x')
>>> m.group(2)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: no such group
>>> m = re.search(r'(x)',z)
>>> m.group(0,1)
('x', 'x')
>>> m.group(2)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: no such group
I also tried putting words in between the last x's and that didn't work either.