// 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)^[\d\.]+\s+(\S+)").unwrap();
let string = "2.0 HSD-U 664-999-01 c301036 1251-A 5445
ChanBoard0 233-455-00 c303bb6 1521-A 5445
ChanBoard1 321-493-00 c303496 1321-A 5445
6.0 DC-07 888-375-02 0C31F8F1 1330-A 5445
aka: 604-375-00
DC-07 123-456-01 0C6203EF 1150-A 5445
aka: 939-420-00
7.0 DC-07 613-493-00 c303496 1321-A 5445
aka: 466-456-65
DC-07 613-493-00 c303496 1321-A 5545";
// 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/