// 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"^(?s).*Subject:(?<identificationValue>ST[0-9]*)\.\d*\.\d*\.(?<identifier>[0-9]*).*Text: (?<remark>.*)Code:.*$").unwrap();
let string = "From:stoerungen@fe-trading.at
Subject:ST412.3.3.28 [RCT/28]: Kartenleserfehler, bitte pruefen!
Send date:Mon May 08 13:28:51 CET 2017
Content type:text/plain; charset=\"iso-8859-1\"
System: RCT/FAULT (08.05.2017 13:28:51)
Station: ST412, 4846 Redlham, Gewerbepark Ost 27
Text: Kartenleserfehler, bitte pruefen!
Gruppe: 3
Device: 3
Code: 28";
// 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/