I have a regular expression in which I try to extract every group of letters that are not immediately followed by the symbol “(”. For example, the following regular expression works with a mathematical formula that includes the names of variables (x, y and z) and the names of functions ( movav and movsum), both of which consist entirely of letters, but where the function names are followed by "(".
re.findall("[a-zA-Z]+(?!\()", "movav(x/2, 2)*movsum(y, 3)*z")
I would like the expression to return an array
['x', 'y', 'z']
but instead returns an array
['mova', 'x', 'movsu', 'y', 'z']
I understand why the regex will return a second result, but is there a way to change it to return an array ['x', 'y', 'z'] ?
Abiel source share