$re = '/((AD)|(AG)|(EX))[0-9]{8}/mi';
$str = 'EX09551115
AD09551115
AG09551115
EA09551115
EG09551115
AE09551115
AX09551115
DG09551115
GD09551115
XE09551115
GA09551115
DA09551115
XD09551115
XG09551115
GX09551115
DX09551115';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php