$re = '/^\w(\d{1,})\.\w(\d{0,2})/m';
$str = 'B43.C21.D10.E110
B52.C21.D22.E000
B52.C21.D22.E000
B42.C11.D10.E120
B42.C11.D10.E120
B42.C11.D10.E120
B42.C11.D10.E120
B42.C11.D10.E120
B42.C11.D10.E120
B42.C11.D10.E120
B42.C11.D10.E120
B42.C11.D20
B42.C11.D20
B46.C71.D11.E000
B81.C21.D10.E000
B80.C20.D10.E000
B81.C10.D10.E000
B35.C11.D10.E116
B19.C20.D2
B81.C10.D10.E000
B80.C20.D10.E000
B46.C3
B36.C00.D11.E000';
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