$re = '/^[A-Z0-9]{8}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{12}[.]pdf$/mi';
$str = '5b7f991f-0726-4dd5-856e-7cea820f02c5.pdf
138bcee6-db7f-47a7-97bf-69c0b3989698.pdf
e988315b-ade7-48e5-9733-35bb59a3c28d.pdf
8 alphanumeric chars, -, 4 alphanumeric chars, -, 4 alphanumeric chars, -, 4 alphanumeric chars, -, 12 alphanumeric chars + .pdf.';
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