Which is the good way to validate a mathematical variables expression. Whether we can use stack or with regex expression.
I have gone with http://www.sanfoundry.com/java-program-implement-evaluate-expression-using-stacks/
Note: The expression does not contain parenthesis. For example:
Valid:
x+3-y/2
x+y
2+4+e
Invalid:
x++4+8
e-3r
e+r34-
How to validate the above expressions?I need to validate the mathematic expression input provided by user in java