// 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)(?i)^(Where|How|Is|Does|I wanna|I want|I wish)\b.*\bdemo( game| version( of the game)?)?( exist| available| out there)?(\.|\?|!)*?$").unwrap();
let string = "How can I download the demo
Where get demo?!?!
where is the demo version of the game?
How do I get the demo game!
Anyone know how to get the demo?
How does one download a geneshit
so I was wondering, how do we get more newbies to play the demo
Does a demo version of the game exist?!?!?
Is a demo version of the game available
is a demo version of the game out there
Is there a demo version?
I wish there was a demo version
is a demo out there?";
// 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/