// 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)^((?!1|2|12|34).)*$").unwrap();
let string = "0 ABCD
1 EFGH
2 IJKL
3 MNOP
4 ABCD
5 EFGH
6 IJKL
7 MNOP
8 ABCD
9 EFGH
10 IJKL
11 MNOP
12 ABCD
13 ABCD
...
AB 1 CD
...
31 EFGH
32 ABCD
33 ABCD
34 ABCD
35 ABCD
";
// 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/