title: Java regex count size with Pattern
body: <p>I want check a string with this Patern:</p>
  
  <pre><code>Pattern.compile("^0*(([a-q]{6,}|[A-Q]{6,}){6,24})(1{6,})(([a-q]{6,}|[A-Q]{6,}){6,24})(1*0*$)");
  </code></pre>
  
  <p>The length of  <code>[a-q]</code> can not be more than 6. And the length of <code>[a-qA-Q]</code> can not be more than 24.</p>
  
  <p>For example:  <code>max 24(min 6(aaaaaa)AAAAAAAbbbbbbbbb)111111...</code>  </p>
  
  <p>But the code use the group (aaaaaa) like 1 element, and should count like 6 elements. And i need use OR to <code>[a-q]|[A-Q].</code></p>
  
  <p>How can i do this with 1 pattern?</p>