using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(?<=(;\d{4}-\d\d-\d\d\n))((?:[^;]++|;)*?)\1";
string substitution = @"\2";
string input = @"№;Задача;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.";
Regex regex = new Regex(pattern);
string result = regex.Replace(input, substitution);
}
}
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 C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx