html - what would be the regex for 0 through 10 accepting decimals in .1 increments? -
i dont know how use javascript reason why im using regex. using foundation's abide component. know how can validate 0 through 10 accepting decimals in .1 increments?
so 1.2
3.8 accepted
11
5.88 not accepted
<div class="small-6 columns"> <input type="number" class="small-3 small-offset-3 columns" required pattern="([0-9]|10)"> </div>
use pattern ^((?:[0-9]|10)(?:\.[0-9])?)$
demo
per m42's correct comment (+1), use modified pattern ^((?:[0-9](?:\.[0-9])?|10(?:\.0)?))$
demo
Comments
Post a Comment