Can someone tell me how to match a number between 1-17 with a regex:
I tried [1-9]|1[0-7] but it matches 8 in the 18 for example because of the first part.
A
You need to put anchors around the regex or it will match substrings:
^(?:[2-9]|1[0-7]?)$
I've also taken the liberty to make your regex a bit more efficient: