For the purpose of writing a calculator, like the python interpeter, I want to check the validity of my expressions.
I want to check a string for repeated mathematical operators, I don't want to catch anything, just to know if they exist, in which case the expression would be invalid.
4++-+4 is valid.
4*-8 is invalid
4-/7 is invalid
4/-4 is valid, mine probably fails here.
minut and plus can repeat themselves, but -* is, for example, invalid. Much like the way the python interpeter works. This is what I have, as a Regex, but any simpler solution is welcome, even not regex is great.
[*/^%\-+][*/^%] | [\-+*/^%][*/^%]
Basicially, check if operators */^%-+ are either preceded by or followed by */^% (without minus and plus)