I’m trying to match a string that has a pattern similar to a function declaration.
line='fun x(a,b,c,d)'
m=re.match(r'fun (w+)((w+)(,w+)*)',line)
print(m.groups())
Surprisingly it prints the output as (‘x’, ‘a’, ‘,d’) instead of the expected (‘x’, ‘a’, ‘b’, ‘c’, ‘d’)
I know I can use other methods to solve this specific problem (find_all, split, etc.) but I want to figure out what I don’t understand about match behavior