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
When I input your regex in RegexBuddy using the Java regex syntax, it displays following message
Quantifiers must be preceded by a token that can be repeated «{2}»
Changing the regex to explicitly use a grouping ^(\d{1}){2}
solves that error and works as you expect.
I assume that the java regex engine simply neglects the error/expression and works with what has been compiled so far.
Edit
The reference to the IEEE-Standard in @piet.t's answer seems to support that assumption.
Edit 2 (kudos to @fncomp)
For completeness, one would typically use (?:)
to avoid capturing the group. The complete regex then becomes ^(?:\d{1}){2}