$re = '/^<<<<<<< HEAD(?:(?!=======)[\s\S])*=======(?:(?!>>>>>>> \w+)[\s\S])*>>>>>>> \w+/m';
$str = '// Somes code
$done[\'rules\'] = TRUE;
<<<<<<< HEAD
$conf[\'some_unit_id\'] = \'4-qw-gg-ds-sometext\';
=======
// Some Snippets Site Info
$conf[\'site_info\'] = array(
\'customer_service_phone\' => \'+1 323223232
\'logo_path\' => \'https://www.google.com/img/icons/src/logo.svg\',
\'currency\' => \'CAD\',
\'https://www.youtube.com/user/somewebsite/ogog\',
\'https://www.instagram.com/somewebsite/\',
),
);
>>>>>>> ff6df3435231fdff78fwsd83e7dffa0732eft554
// Somes code
$done[\'rules\'] = TRUE;';
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