// 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"(?mi)(\B(\?\?|\?)|\B(\!\!|\!)|\B(\[\])|\b(RWC)|\b(TODO))[:;.,-]?\d*($|\s.*$|\(.*$)").unwrap();
let string = "# Oh yeah, good luck with that.
?? Can I use the gun?
Enough about your promiscuous mother, Hermes! We have bigger problems.
!!- Guards! Bring me the forms I need to fill out to have her taken away!
TODO Shinier than yours, meatbag.
- Wow, you got that off the Internet?
- In my day, the Internet was only used to download pornography.
Would you censor the Venus de Venus just because you can see her spewers?
! No argument here.
RWC: Oh no! The professor will hit me!
[] But if Zoidberg 'fixes' it… then perhaps gifts!
I was all of history's great robot actors - Acting Unit 0. 8; Thespomat; David Duchovny!
[] Five hours? Aw, man! Couldn't you just get me the death penalty?
When I was first asked to make a film about my nephew, Hubert Farnsworth, I thought \"Why should I?\" Then later, Leela made the film. But if I did make it, you can bet there would have been more topless women on motorcycles. Roll film! Um, is this the boring, peaceful kind of taking to the streets?
";
// 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/