I have to validate a decimal number based on the digits provided before the decimal and after the decimal. Say i have a function which is having a regular expression and takes two parameters as digits before the decimal and digits after the decimal.
function validateDecimalNo(digitBeforeDec,digitAfterDec){
//here i need to write the regular expression to validate the decimal no based on the inputs.
}
- If i pass 2,3 it should check decimal no as per this restriction
- If i pass 10,6 it should validate no as per this restriction
- If i pass 4,2 it should validate no as per this restriction
How to create the single dynamic regular expression to meet above requirement.