var precision = !!values.amountprecision && values.amountprecision || '2';
var temp = /^\d+(\.\d{1,2})?$/;
temp.test(1.1221);
In the above expression, i have explicitly mentioned 1 to 2 values after decimal points. but i want to set the digits after decimal point should be based on the precision variable.