I have the following sample string:
R10666: 273141 C1 + 273141 C2 + 273141 C3 + 273141 C4 + 273141 C5 - 273141 C6
I want to obtain:
[('273141','C1'), ..., ('- 273141', 'C6')]
The numbers can be floating point numbers with exponential notation i.e. - 2.5e-7
.
My current regex looks like this:
re.findall(r'([+-]? \d+(\.\d*)?|\.\d+([eE][+-]?\d+)?)( [a-zA-Z0-9_]+)', split)
But it doesn't produce the correct output, what is wrong with it?
This is a sample output:
(' 273141', '', '', ' C1')
or it matches nothing.