$re = '/\bid\s+:\s*\b([0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12})\b/m';
$str = 'id : 42cdb643-0a11-416b-b66b-7bb28a9a20ea
isReadOnly : False
somestring : False
somestring : {}
name :
id : d006d69e-8d04-48d7-8806-cdc39c18e679
somestring : False
somestring : False
somestring : 822F0340-818A-4F23-AA78-633B6436913F
upstreamDataflowsOfDatasets : {}';
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