Answers for "validate decimal number with 6 decimal digits javascript"

1

validate decimal number with 6 decimal digits javascript

var regexp = /^\d+(\.\d{1,2})?$/;

console.log("'.74' returns " + regexp.test('.74'));
console.log("'7' returns " + regexp.test('7'));
console.log("'10.5' returns " + regexp.test('10.5'));
console.log("'115.25' returns " + regexp.test('115.25'));
console.log("'1535.803' returns " + regexp.test('1535.803'));
console.log("'153.14.5' returns " + regexp.test('153.14.5'));
console.log("'415351108140' returns " + regexp.test('415351108140'));
console.log("'415351108140.5' returns " + regexp.test('415351108140.5'));
console.log("'415351108140.55' returns " + regexp.test('415351108140.55'));
console.log("'415351108140.556' returns " + regexp.test('415351108140.556'));
Posted by: Guest on June-21-2021
1

validate decimal number with 6 decimal digits javascript

/^\d+(\.\d{1,2})?$/
Posted by: Guest on June-21-2021

Code answers related to "validate decimal number with 6 decimal digits javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language