I try to find arithmetic expressions in text strings.
Possible arithmetic expression:
1/3 + 1/4
cos(30) + 25*3,75
sqrt(5) + sin(45)
5 != 6
2**4 + 100.000 =
(2^3)^4
sqrt((0,25*8)/2)
3e4 - 500
I created a regex and used the |
symbol between the blocks.
pattern = '((\s*(sqrt|a?sin|a?cos|a?tan|abs|log|log10|exp)?\s*)* | (\s*[e0-9,.()\-]+\s*)* | (\spi\s*)* | (\s*[-+*/%^<>!=]*\s*)*)(\s*\=?\s*)?'
What I really want is that all blocks can be used interchangeably in any order.
How can I do that? It doesn't work using |
symbol.