How to check with regularies, the correctness of the input of a mathematical expression? Everything is not as I can not think of, a mathematical expression may include the following set of characters = + - * / () [az]. That is, this is a list of valid expressions:
x=x+1 (x+1)=sav*10/(2+1) a+b=c (r+w)/2 a=3+5/(3*10(-10/4)) +a--3+50 And this is a list of incorrect:
=2+r ((d+f) *e=f g=/3 3=4//5 x=5/ df= Those. in theory, you need to recursively open parentheses, and check the sequence of certain characters.