I have a regex that can match a string in multiple overlapping possible ways. However, it seems to only capture one possible match in the string, how can I get all possible matches? I've tried finditer with no success, but maybe I'm using it wrong.
The string I'm trying to parse is:
foo-foobar-foobaz
The regex I'm using is:
(.*)-(.*)
>>> s = "foo-foobar-foobaz"
>>> matches = re.finditer(r'(.*)-(.*)', s)
>>> [match.group(1) for match in matches]
['foo-foobar']
I want the match (foo and foobar-foobaz), but it seems to only get (foo-foobar and foobaz).