// 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)^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$").unwrap();
let string = "11-D6-D4-D7-B0-80
B5-42-A1-A7-33-B1
8C-03-74-2B-C6-D1
B5-5E-20-CH-1D-E6
7F-83-86-B6-7A-93
31-CE-78-13-75-FF
E5-EF-62-80-46-BC
D8-G2-44-10-49-E8
C6-45-E2-C5-D8-B3
F2-CA-6C-77-C3-7D
05-A0-4F-8A-F9-71
82-7B-DZ-D5-06-DA
B8-9F-45-90-D9-B3
82-7B-D6-D5-06-DA
";
// 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/