Click here to Skip to main content
15,885,711 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm new to Regular expression validations in javascript.

My textbox allows the user to enter FORMULA which needS to be validated client side.

My Formula Can be made of following operators

+
_
*
/
(
)
%

these are the only symbols allowed in my textbox.

need to validate a formula

wchic should be like "CurrentbaseSalary+CurrentMBP(BPI)"

but should not be "+BPI-CBI("
should be a valid formula.

please help.

Thanks in advance.
Posted

If the eval[^] function doesn't fit your needs you might Google for a Javascript expression parser[^].
 
Share this answer
 
Comments
Maciej Los 25-Aug-15 8:13am    
Fair enough, 5!
I do strongly recommend you to read this: JavaScript Calculator[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900