// 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)(?P<Module>^\w+)+\s+(?P<Name>.{1,}(?=Ke|Fi))+(?P<Type>(Kernel|File System))").unwrap();
let string = "1394ohci 1394 OHCI-совместимый Kernel
3ware 3ware Kernel 19.05.2015 3:28:03
ACPI Драйвер Microsoft ACPI Kernel
AcpiDev Драйвер устройств с AC Kernel
acpiex Microsoft ACPIEx Drive Kernel
acpipagr Драйвер агрегатора про Kernel
AcpiPmi Драйвер устройства изм Kernel
acpitime Драйвер ACPI Wake Alar Kernel
Acx01000 Acx01000 Kernel
ADP80XX ADP80XX Kernel 10.04.2015 1:49:48
AFD Драйвер дополнительных Kernel
afunix afunix Kernel
ahcache Application Compatibil Kernel
amdgpio2 Драйвер GPIO-клиента A Kernel 07.02.2019 14:32:20
amdi2c Служба контроллера I2C Kernel 20.03.2019 9:57:33
AmdK8 AMD K8 драйвер процесс Kernel
AmdPPM Драйвер процессора AMD Kernel
amdsata amdsata Kernel 14.05.2015 17:14:52
amdsbs amdsbs Kernel 12.12.2012 2:21:44
amdxata amdxata Kernel 01.05.2015 5:55:35
AppID Драйвер AppID Kernel
applockerflt Драйвер фильтра Smartl Kernel
bindflt Windows Bind Filter Dr File System
bowser Браузер File System
BtFilter BtFilter Kernel 25.01.2019 10:46:26";
// 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/