// include the latest version of the regex crate in your Cargo.toml
extern crate regex;
use regex::Regex;
fn main() {
let regex = Regex::new(r"(?m)((((о|е|ё)(в|ц)а?)|((ы|и)на?))|(о|а(й|к|у|ч)?)|(к((о|и)й|ая))|(и(ч|ц))|((ы|и)(х|й)|ая)|((у|ю|о)(к|н|б))|(штейн|манн?|сон))\b").unwrap();
let string = "Смирнов/Cмиров
Николаев/Николаева
Никитин/Никитина
Киселёв/Киселёва
Пятницын/Пятницына
Крыленко
Хованский/Хованская
Калита
Шемяка
Донской/Донская
Теплых
Усович
Царук
Нагорный/Нагорная
Деньнуб
Заренок
Шевчук
Драгун
Харинтон
Горбатых
Фидорец
Слободенюк
Кравчук
Голицын
Лифшиц
Либерман
Капица
Айнштейн
Лазерсон
Байдачный/Байдачная
Зварыкин/Зварыкина
Коллонтай
Cобчак
Ландау
Василец
Кучерявый
Бородач
Грицюк
Радаев
Белаец
Деев
";
// result will be an iterator over tuples containing the start and end indices for each match in the string
let result = regex.captures_iter(string);
for mat in result {
println!("{:?}", mat);
}
}
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 Rust, please visit: https://docs.rs/regex/latest/regex/