$re = '/^(?s).*Subject:(?<identificationValue>ST[0-9]*)\.\d*\.\d*\.(?<identifier>[0-9]*).*Text: (?<remark>.*)Code:.*$/';
$str = 'From:stoerungen@fe-trading.at
Subject:ST412.3.3.28 [RCT/28]: Kartenleserfehler, bitte pruefen!
Send date:Mon May 08 13:28:51 CET 2017
Content type:text/plain; charset="iso-8859-1"
System: RCT/FAULT (08.05.2017 13:28:51)
Station: ST412, 4846 Redlham, Gewerbepark Ost 27
Text: Kartenleserfehler, bitte pruefen!
Gruppe: 3
Device: 3
Code: 28';
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