// 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)((\w{2}\d{4}\w)\/(\w{2}\d{4}\w\d{2}\w{3}))\s(\w{6})\s(\w+)\/(\d{4})\s(\d{4})").unwrap();
let string = " LMZ333 ALLOTMENT (0000) *TSC
HDQRM5I
.MADRIIB 160846
MADIB HQXL4/MADIB0009/7849644/MAD/IB/A/ES//RC//
1CUVILEON/CARLOS EDUARDO
5I8397J/IB2198J25JUN RZGMAD CS1/0850 1220
5I8327J/IB2194J06JUL MADRZG CS1/1745 2115
OSI 5I CTCP 34606686051-M
OSI 5I POSI-DSAC//MADIB08AB/I/1
OSI 5I CARLOSCUVILIN//GMAIL.COM
=
˜ ";
// 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/