Is there a more efficient way to check integers in the intervall from 0 to 250?
Regular Expression:
^([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|250)$
Or what about an intervall from 0 to 20'000, 0 to 100'000, etc.?
Is there a more efficient way to check integers in the intervall from 0 to 250?
Regular Expression:
^([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|250)$
Or what about an intervall from 0 to 20'000, 0 to 100'000, etc.?
Not really; you can shorten it a tiny bit:
^([1-9]?[0-9]|1[0-9][0-9]|2[0-4][0-9]|250)$
But regexes are not good for number ranges, especially arbitrary ranges.