title: preg_match match a defined number of characters requiring at least one digit and at least one letter
body: <p>I need a regex to extract a code_number,
  the requirements are:</p>
  
  <ul>
  <li>It must be 5 characters long</li>
  <li>It must contain at least one digit in any position</li>
  <li>It must contain al least one letter in any position</li>
  </ul>
  
  <p>Ideally this should be done using only one regex.</p>
  
  <p>With the following regex I'm almost there, the problem is that this regex does not comply whit the third requirement, it should not match the <code>11111</code> because the lack of at least one letter</p>
  
  <pre><code>$regex = '~\b(?=[a-zA-Z0-9]{5}\b)[a-zA-Z0-9]*\d[a-zA-Z0-9]*~';
  $sms = ' 11111 keyrod  07:30 02.10.2013';
  
  preg_match($regex, $sms, $matches);
  
  print_r($matches); // print array([0] =&gt; 11111)
  </code></pre>
  
  <p>How could I change this regex to not match a string of only number?</p>