title: PHP regex random pattern of 5 characters
body: <p>I am trying to check a license key with a pattern of 5 groups of 5 random letters separated by "-". I would like to verify the following: each group consists of 5 letters, each group does not contact certain letters, and all of the groups are capital letters. I know I can do this with the following, but I believe there is an easier method with a possible single regex expression:</p>
  
  <pre><code>$testKey = 'ASDFG-ASDFG-ASDFG-ASDFG-ASDFG';
  $testKeyArray = explode('-', $testKey);
  $cntKey = count($testKeyArray);
  if($cntKey != 5) {
      echo 'Failed';
  } else {
      for($x=0;$x&lt;$cntKey;++$x) {
          if(strlen($testKeyArray[$x]) != 5) {
              echo 'Failed';
          }
          if(preg_match("^[B]^",$testKeyArray[$x]) == 1) {
              echo 'Failed';
          }
      }
      echo 'Success';
  }
  </code></pre>
  
  <p>Any help would be greatly appreciated.</p>