I need a help in writing a validator in javascript or JQuery for a string expression that will allow arithmetic expressions like (),+,-,*,/,min(),max(),avg().
In the string, min(),max(),avg() should allow only two arguments.
Sample string expression to validate :
(x+y+max(min(x,y),z)+avg(x,y)*z/y)
Well first question is… why.
Second question is what have you done so far?
1 Like
You don’t need a regex for this. Regex can solve a lot of problems, but most problems that can be solved using regex can be better solved another way.
In this case what you’d need is a parser and a tokenizer to cut the expression into bits and then evaluate the different parts.
1 Like
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.