Regular expression numerical range of matches

I am trying to write a simple regular expression to match the percentage range of 1% -100%

Is there a better way to write this?

^([1-9]|[1-9][0-9]|100)%$
+3
source share
1 answer

You can make it a little shorter:

^([1-9][0-9]?|100)%$
+4
source

Source: https://habr.com/ru/post/1742295/


All Articles