// 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)(\d{2}\s*\d{2})\s*[\W*]\s*(\d{3,6})").unwrap();
let string = "
серия 3204 09988, выдан 07.02.2005г, Отделом Внутренних Дел
серия 3204 № 099881 ,
32 04 № 099881 ОВД р-на 07.02.2005г.
серия 3204 № 099881 ,lorem
серия 3204 номер 099881, выдан 07.02.2005г, Отделом Внутренних Дел обл. код подразделения: 569-007
паспорт 32 04 099881
серия 32 03 818655, выдан
серия 32 11 045497, выдан 15.03.2011г.,
Серия 3214 № 426428 Выдан 03.03.2011 Отдел
Серия 32 10 № 980598 Выдан 03.07.2010 Отдел УФМС \\
32 08 803828 ОУФМС России по области
Паспорт 32 14 номер 498391
Паспорт серия 80 02 номер 279 781 по Оренбургской 31.04.2019
Паспорт 32 10 966241
";
// 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/