Regular Expression - Two Digit Range (23-79)?

前端 未结 5 1228
天涯浪人
天涯浪人 2021-02-15 18:31

I have been reading the regex questions on this site but my issue seems to be a bit different. I need to match a 2 digit number, such as 23 through 75. I am doing this on an H

5条回答
  •  臣服心动
    2021-02-15 19:00

    If I want 2 digit range 0-63

    /^[0-9]|[0-5][0-9]|6[0-3]$/
    
    1. [0-9] will allow single digit from 0 to 9
    2. [0-5][0-9] will allow from 00 to 59
    3. 6[0-3] will allow from 60 till 63

    This way you can take Regular Expression for any Two Digit Range

提交回复
热议问题