title: Regex - determine matrix from String
body: <p>how can I create simple matrix for String that could be contains following combinations</p>
  
  <pre><code>123456 ABC    
  123456AB1
  123456AB12
  123456AB123
  123456
  </code></pre>
  
  <p>for example</p>
  
  <pre><code>if ("\\d + \\d + \\d + \\d + \\d + \\d  
     + \\s 
     + [a-zA-Z]+[a-zA-Z]+[a-zA-Z]") {
     //passed variant from input in form 123456 ABC
  
  } else if ("\\d + \\d + \\d + \\d + \\d + \\d 
     + [a-zA-Z]+[a-zA-Z]+[a-zA-Z]
     + \\d") {
     //passed variant from input in form 123456AB1
  
  } else if ("\\d + \\d + \\d + \\d + \\d + \\d 
     + [a-zA-Z]+[a-zA-Z]+[a-zA-Z]
     + \\d + \\d") {
     //passed variant from input in form 123456AB12
  
  } else if ("\\d + \\d + \\d + \\d + \\d + \\d 
     + [a-zA-Z]+[a-zA-Z]+[a-zA-Z]
     + \\d + \\d + \\d") {
     //passed variant from input in form 123456AB123
  
  } else if ("\\d + \\d + \\d + \\d + \\d + \\d") {
     //passed variant from input in form 0123456
  
  } else {
     //doesn't match
  }
  </code></pre>