search

Home  >  Q&A  >  body text

javascript - Regular match is greater than 0, no greater than 16, no more than two decimal places

0No
0.01Yes
15.99Yes
16Yes
16.01No

欧阳克欧阳克2832 days ago1037

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-06-24 09:45:27

    It’s time to do practice questions

    /^((0\.((0[1-9])|([1-9]\d?)))|(([1-9]|1[0-5])(\.[\d]{1,2})?)|(16(\.0{1,2})?))$/

    reply
    0
  • 淡淡烟草味

    淡淡烟草味2017-06-24 09:45:27

    It can be achieved like this

    var num=15.61;
    var t=num.toString();
    if(num>0 && num<16 && t.length>0 && t.length<6){
        alert(num);
    }

    reply
    0
  • Cancelreply