1: 2: 3: 4: 5: 6: 7: 8: 9:
<?php $testArray = array( "ahsaj", "272727", "aa", "11", "a1", "aa", "1a", "11" ); $pattern = '~^([0-9]{1}[a-zA-Z]{1}|[a-zA-Z{1}][0-9]{1})$~'; foreach( $testArray as $aTest ) if ( preg_match( $pattern, $aTest ) > 0 ) echo "$aTest is OK<br/>";