Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

RegEx Pattern Validations failing on html input

const regex = /^(?![0,.]*$|0d*$)d{1,3}(?:,d{3})*(?:.d{1,2})?$/;
[
  "0",
  "012",
  "0.00",
  "0.0",
  "0.",
  "00122",
  "0.12",
  "0.01",
  "1,234.00",
  "1.00",
  "123,456",
  "1.23"
].forEach(s => console.log(`${s} --> ${regex.test(s)}`));
 
PREVIOUS NEXT
Tagged: #RegEx #Pattern #Validations #failing #html #input
ADD COMMENT
Topic
Name
5+5 =