I have a pattern for a strings like "5", "54", "1/19/99", "99/88/77" - each section separated by "/" can contain number in the range of 1-99 and the amount of such parts can be from 1 to n. For that purpose I use this regular expression:
/^[1-9]{1,2}(\/[1-9]{1,2})*/
I have 2 questions:
- This regular expression give positive test for a string like "123456". Why?
Can I dynamically use n to set the max amount of parts that can be used, let's say like this:
/^[1-9]{1,2}(\/[1-9]{1,2}){0, n}/