$re = '/^TEXT\h([A-Z0-9]{14})/m';
$str = 'Material B7E671143D244B
====================================
TEXT 2F3139D816C34D 1
TEXT B6A968EF2505A2 1
TEXT 35206697A04F91 1
TEXT EB485AF490D83D 1
TEXT 0DAB42294BD9B3 1
TEXT 3D6525BEE360E1 0
Material D6906B886B06E3
====================================
TEXT 0CCECCCCFB62AE 1
TEXT 1E14CB29AB43F0 1
TEXT FB7F0DCE9B5950 1
Material 431831490FD5C9
====================================
TEXT 9D77B6474696D8 1
TEXT D04DEE5DF130A4 1
TEXT B6A968EF2505A2 1
TEXT 8C37245A4F0F81 1
TEXT A39FAFFC5ABC06 1
TEXT D24199644F2EE6 1';
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