// 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)(?=^|[A-Z]?\s)(.\d{1,2}["+-]?\s.*?)(?=MS\D\D.\d|.\d\D\D\D\D\D|.\d\D\D.\d|AW\D\D\D\D\D|AW\D\D.\d)(MS\D\D.\d|.\d\D\D\D\D\D|.\d\D\D.\d|AW\D\D\D\D\D|AW\D\D.\d)"#).unwrap();
let string = "14+ Ywu&rb12AiBNL
18- vu20BEBNL
^15+ vwu&ob12Ai18C
C C 20\" &dg15BE23C
19- vu20AQ 5
S S 20\" w16BE26S
24 MSBE 6
N 22- MSBE15N
G22 AWAiRBa
.26\" AWFE 8";
// 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/