I need to extract the names of variables from a function string.
A variable can be [a-zA-Z0-9]+ but not a real number notated like 1, 3.5, 1e4, 1e5...
Is there a smart way of doing this?
Here's a M(not)WE in python:
import re
pattern = r"[a-zA-z0-9.]+"
function_string = "(A+B1)**2.5"
re.findall(pattern, function_string)
The above code returns:
A, B1 and 2.5.
My desired output is
A and B1.
And here's a nice way of testing the regular expressions: https://regex101.com/r/fv0DfR/1