// 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)(?<=\s)1(?=[A-Za-z])").unwrap();
let string = "-ABC046Y 1SMITH/FREDMR
.L/JCD5CQ
.R/TKNE HK1 6002300348396/1-SMITH/FREDMR
.R/SEAT HK1 9F
.R/FQTV AB 60042576-1SMITH/FREDMR 1DOE/JANEMISS
.L/JC93QW
.R/TKNE HK1 6002300219029/2-1DOE/JANEEMISS
.R/SEAT HK1 8A
.R/CHKD HK1 011-1DOE/JANEMISS 1PRESLEY/ELVISMR-A2 ";
// 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/