// 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"\b(\p{L}{3}),\ (\p{L}{3})\ (\d\d),\s(\d\d\d\d)\ at\ (\d\d?):(\d\d)\ ([AP]M)").unwrap();
let string = "kardashian, kim this is dummy text area
mercury, freddie Tue, Aug 23, 2016 at 2:21 PM
22.11.2016 08:58 AM
last_name, first_name
bjorge, philip ";
// 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/