Im trying to make regex for Math terms. The rules are at beginning very simple: no variables, and operators are + -. Something I come up with was :
^[(]*-?\d+(\.\d+)*([+-]{1})*(([(]*-?\d+(\.\d+)*([+-]{1})*[(]*(-?\d+(\.\d+)*([+-]{1})*[)]*)*)*([+-]{1})*)*[+-]{1}-?\d+(\.\d+)*[)]*
Functioned for complicated terms but for those not complicated not. Any advice ?