I need to validate a text based upon a regular expression in javascript. My regular expression is working fine but but can't find out why it is not working in java script.
The regular expression is this , ^([-+/*]\d+(\.\d+)?)*
Valid expressions are +7 or +9.36*8 or +4-9.3/5.0
Invalid matches are test or 8.36
Here is the code,
var ck_diffrentialformula = /^([-+/*]\d+(\.\d+)?)*/;
function radtxtbxLinkedDifferentialFormulaOnBlur(sender, eventArgs) {
if (sender.get_value().length > 0) {
var entered_value = sender.get_value();
if (ck_diffrentialformula.test(entered_value)) {
alert('Text Matches');
}
else {
alert('Text does not match');
}
}
}
sender.get_value() - gives the text box value over here.
Please tell me where I am doing wrong.
sender.get_value()immensely (and what you expect the alert to be).