$re = '/(?<=(;\d{4}-\d\d-\d\d\n))((?:[^;]++|;)*?)\1/';
$str = '№;Задача;T;O;P
;2016-01-18
1. ;task1;03:00;.;
;2016-01-18
2. ;task2;03:00;.;
;2016-01-18
3. ;task3;03:00;.;
;2016-01-19
7. ;33333;03:00;.;
;2016-01-19
8. ;d;03:00;.;
;2016-01-19
9. ;00;03:00;.;
;2016-01-20
21. ;task1;03:00;.;
;2016-01-20
22. ;task2;03:00;.;
;2016-01-21
25. ;testtime;03:00;.;
;2016-01-21
26. ;fgghgfh;23:45;.;, new t.';
$subst = "\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