how to match a number which is less than or equal to 100?

前端 未结 7 1474
耶瑟儿~
耶瑟儿~ 2020-12-03 04:35

I want to match a number which is less than or equal to 100, it can be anything within 0-100, but the regex should not match for a number which is greater than 100 like 120,

7条回答
  •  眼角桃花
    2020-12-03 05:16

    regex for this

    perl -le 'for (qw/0 1 19 32.4 100 77 138 342.1/) { print "$_ is ", /^(?:100|\d\d?)$/ ? "valid input" : "invalid input"}'
    

提交回复
热议问题