javascript - regex to validate three digit with one decimal -


i have written regex validate number containing 3 digits , 1 decimal return false in cases.

re = new regexp("^\d{1,3}\.*\d{0,1}$"); re.test(33.0); 

i tried many combinations not working. aim validate number @ max 3 digit 1 decimal , less 100. can handle less 100 part.

this 1 want:

var test = [  123,  12.34,  100.1,  100,  12,  1.2,  1  ];  console.log(test.map(function (a) {    return a+' :'+/^(?:100(?:\.0)?|\d{1,2}(?:\.\d)?)$/.test(a);  }));


Comments

Popular posts from this blog

python - RuntimeError: can't re-enter readline -

python - PyInstaller UAC not working in onefile mode -

php - Need to store a large amount of data in session with CI 3 but on storing large data in session it is itself destorying automatically -