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 exactly once) exactly twice, i.e. a digit exactly twice.
But it, in fact, appears to just mean "a digit exactly once" (thus ignoring the {2}).
String regex = "^\\d{1}{2}$"; // ^$ to make those not familiar with 'matches' happy
System.out.println("1".matches(regex)); // true
System.out.println("12".matches(regex)); // false
Similar results can be seen using {n}{m,n} or similar.
Why does this happen? Is it explicitly stated in regex / Java documentation somewhere or is it just a decision Java developers made on-the-fly or is it maybe a bug?
Or is it in fact not ignored and it actually means something else entirely?
Not that it matters much, but it's not across-the-board regex behaviour, Rubular does what I expect.
Note - the title is mainly for searchability for users who want to know how it works (not why).