// 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)^(.{2})(.{14}).{14}(.{8})(.{8})(.{20})(.{8})(.{1})(.{10}).{2}.{2}(.{2})(.{14}).{10}.{5}(.{16})(.{3})(.{18}).{15}.{15}.{6}.{6}.{2}.{3}.{18}.{10}(.{2}).{3}.{32}.{2}(.{10})(.{15}).{38}.{5}.{5}.{5}.{5}.{5}.{5}(.{16})(.{16})(.{20})(.{3})(.{3})(.{2})(.{20})(.{5})(.{15})(.{10}).{3}.{3}(.{2})(.{24})(.{3})(.{20})(.{2}).{24}(.{6}).{6}.{10}(.{3}).{3}.{3}(.{3})(.{3})(.{5})(.{3})(.{2}).{2}(.{5}).{2}.{20}.{5}.{20}.{2}.{3}.{2}.{5}.{325}(.{14}).{3}.{24}.{25}.{20}.{1}.{1}.{2}.{5}.{3}.{3}.{3}.{6}.{4}.{3}(.{5})(.{5})(.{3})(.{1})(.{3})").unwrap();
let string = "2422072021115242 GU32120300002689543200710020 489346250700918BE0D011 0022072021114833700918BE0D1 04D10790201AEA005 543200710020 1 5 543200310050 100 0 5 5491127654295 1 0 22072021114834 65535 655356553565535655356553565535 3 0 X700
";
// 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/