using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"((((о|е|ё)(в|ц)а?)|((ы|и)на?))|(о|а(й|к|у|ч)?)|(к((о|и)й|ая))|(и(ч|ц))|((ы|и)(х|й)|ая)|((у|ю|о)(к|н|б))|(штейн|манн?|сон))\b";
string input = @"Смирнов/Cмиров
Николаев/Николаева
Никитин/Никитина
Киселёв/Киселёва
Пятницын/Пятницына
Крыленко
Хованский/Хованская
Калита
Шемяка
Донской/Донская
Теплых
Усович
Царук
Нагорный/Нагорная
Деньнуб
Заренок
Шевчук
Драгун
Харинтон
Горбатых
Фидорец
Слободенюк
Кравчук
Голицын
Лифшиц
Либерман
Капица
Айнштейн
Лазерсон
Байдачный/Байдачная
Зварыкин/Зварыкина
Коллонтай
Cобчак
Ландау
Василец
Кучерявый
Бородач
Грицюк
Радаев
Белаец
Деев
";
RegexOptions options = RegexOptions.Multiline;
foreach (Match m in Regex.Matches(input, pattern, options))
{
Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index);
}
}
}
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