// 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)\bCHECKOUT[a-zA-Z_(/ ):]+\w+:\w+\s(?:[AP]M|[ap]m)\s-\s\w+:\w+\s(?:[AP]M|[ap]m)(?!.*\bDRY GOODS\b).*").unwrap();
let string = "CHECKOUT Senior Guest Services Manager FRONTENDMGR: 07:00 AM - 08:30 AM SGSM_BOOKKEEPING: 08:30 AM - 01:00 PM FRONTENDMGR: 01:00 PM - 04:00 PM
CHECKOUT Guest Services Manager BOOKKEEPER: 09:00 AM - 01:00 PM DRY GOODS Receiving Clerk RECEIVE: 04:30 AM - 09:00 AM
DRY GOODS Receiving Clerk RECEIVE: 04:30 AM - 09:00 AM CHECKOUT Guest Services Manager BOOKKEEPER: 09:00 AM - 01:00 PM";
// 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/