// 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)(?!.*:).").unwrap();
let string = "Hilary: YOU KNOW, THIS IS NOT WHY I CAME HERE.
Devon: DOESN'T MATTER.
Hilary: IT DOES. DEVON, WHEN I SAY THAT I'M TIRED OF SNEAKING AROUND, I MEANT IT.
Devon: DON'T GET UPSET, THOUGH.
Hilary: HOW CAN I NOT? I MEAN, LOOK AT WHAT I DID.
Devon: HONEY, HONEY, WE'RE IN LOVE WITH EACH OTHER. OKAY? AND WE KNOW EXACTLY WHAT WE HAVE TO DO. WE'RE GONNA TELL NEIL THE TRUTH.
Hilary: NOW?
Dr. Barrett: I THINK YOU CAN PROVIDE SOME VALUABLE INSIGHT INTO PHYLLIS NEWMAN'S RECENT STATE OF MIND.";
// 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/