$re = '~^((?:"[^"]*";){3})"(?:(?:(\w+@domen\.com)|\w+@[\w.]+)\+?)+~m';
$str = '"mail1@domen.com";"static-text";"";"";"";"mail1";"";"";"";"
"mail2@domen.com";"static-text";"";"mail2@domen.com";"";"mail2@domen.com";"";"";"";"
"mail3@domen.com";"static-text";"";"mail3@xxxxx+mail3@domen.com";"name1";"surname1";"middlename1";"";"";"
"mail4@domen.com";"static-text";"";"mail4@domen.com+mail5@domen.com+mail5@xxxxx";"name2";"surname2";"middlename2";"";"";"
';
$subst = "$1$2";
$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