// 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)(.*Device:\s*(.*?)\s*Serial Number.*)|(.*Gerät:\s*(.*?)\s*Seriennummer.*)|(.*ICD-Model:\s*(.*?)\s*Serial Number:.*)|(.*ICD-Modell:\s*(.*?)\s*Seriennummer.*)|(.*Pacemaker Model:\s*(.*?)\s*Serial Number.*)|(.*Schrittmachermodell:\s*(.*?)\s*Seriennummer:.*)").unwrap();
let string = "Device:REVEAL LINQ LNQ11 Serial Number:RLA087267G Date of Visit:03-Jul-2019 08:10:51
Gerät:Viva Quad XT CRT-D DTBA2QQ Seriennummer:BLG613658S Untersuchungsdatum:27-Apr-2018 12:34:06
ICD-Modell: Marquis VR 7230 Seriennummer: PKD616419S Untersuchungsdatum:12, Mai 2015
ICD-Model: Marquis VR 7230 Serial Number: PKD616419S Untersuchungsdatum:12, Mai 2015
Pacemaker Model: Medtronic Adapta ADSR01 Serial Number: NWM851790 Date of Visit: 12/08/17
Schrittmachermodell: Medtronic Adapta ADVDD01 Seriennummer: NWG618042 Nachsorgedatum: 05.12.1";
// 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/