Regex for numeric range from negative numbers?

前端 未结 6 1975
忘掉有多难
忘掉有多难 2021-02-13 19:34

I want to validate a number using regex.. the condition is number can be from any negative 3 digit values to positive 3 digit.. but cannot be zero.

can someone please he

6条回答
  •  迷失自我
    2021-02-13 20:22

    I think in all the above input like this is allowed -2-22,2-22 which is a minor bug.Review this as well :-

    [\-]?[0-9]*$/
    

    even smaller :

    /^[\-]?\d*$/
    

提交回复
热议问题