$re = '/(?i).*?^([0-9A-F]{2}([:-])(?:[0-9A-F]{2}\2){4}[0-9A-F]{2})$/ms';
$str = 'text 1 here
text: example 1
text- ??????
1F:F2:C9:A6:B3:4F
text 2 here
text: example 2
text- ??????!!!@@@
3D:F2:D9:F3:C3:A1
text 3 here
text: example 3
text- ??????!!!@@@
E8:F2:D9:A6:A3:11';
$subst = "$1\n";
$result = preg_replace($re, $subst, $str);
echo "The result of the substitution is ".$result;
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