using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"^([\w\W]+?)((?:\s\w+\.){0,}\[{0,}(`){0,}Дата ввода\3{0,}\]{0,})([\w\W]+)GROUP BY(.+)$";
string substitution = @"$1$2$4 GROUP BY $5, $2";
string input = @"SELECT `Тип заканчивания`, YEAR(`Дата ввода`) AS [Год] FROM [DeleteMe13$A1:B21]
GROUP BY `Тип заканчивания`";
RegexOptions options = RegexOptions.Singleline;
Regex regex = new Regex(pattern, options);
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