- var_dump: documentation ( source)
- preg_match: documentation ( source)
<?php
$input = <<< END
sjbasukbgksdyugaksdfygkasgkasgbaksbgkxbcmahsbg;adfhblzsuglu01 02 03 04 05 06 07 08 09 10 11 12 13 14suighsuighsdasjdgb
ahioguhaughauisdfghiuhab ba 1a 2f 3c 2a 1d 35 32 12 34 78 90 11aklsughaiugaiougdfh
rguh00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
END;
preg_match('/(([a-f0-9]{2} ){27}|([a-f0-9]{2} ){13})[a-f0-9]{2}/i', $input, $matches);
var_dump($matches);