So, some way or another (playing around), I found myself with a regex like \\d{1}{2}
.
Logically, to me, it should mean:
(A digit exac
I have never seen the {m}{n}
syntax anywhere. It seems that the regex engine on this Rubular page applies the {2}
quantifier to the smallest possible token before that - which is \\d{1}
. To mimick this in Java (or most other regex engines, it would seem), you need to group the \\d{1}
like so:
^(\\d{1}){2}$
See it in action here.