$re = '/([^: ]+:[^:]+:([^:]+):[^:]+:[^:]+)(:[^: ]+)/';
$str = 'almada-institute.com:25:info@almada-institute.com:info12345:"hello":nossl in-graph.com:25:info@in-graph.com:info123456789:"hello":nossl get-herbals.net:25:info@get-herbals.net:info321:"hello":nossl
';
$subst = "\1<\2>\3";
$result = preg_replace($re, $subst, $str);
echo "The result of the substitution is ".$result;
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