title: How does {m}{n} ("exactly n times" twice) work?
body: <p>So, some way or another (playing around), I found myself with a regex like <code>\d{1}{2}</code>.</p>
  
  <p>Logically, to me, it should mean:</p>
  
  <blockquote>
    <p>(A digit exactly once) exactly twice, i.e. a digit exactly twice.</p>
  </blockquote>
  
  <p>But it, in fact, appears to just mean "a digit exactly once" (thus ignoring the <code>{2}</code>).</p>
  
  <pre><code>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
  </code></pre>
  
  <p>Similar results can be seen using <code>{n}{m,n}</code> or similar.</p>
  
  <p>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?</p>
  
  <p>Or is it in fact not ignored and it actually means something else entirely?</p>
  
  <p>Not that it matters much, but it's not across-the-board regex behaviour, <a href="http://www.rubular.com/r/eefKxje4nf">Rubular</a> does what I expect.</p>
  
  <p>Note - the title is mainly for searchability for users who want to know how it works (not why).</p>