// 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"(\d{2}:\d{2}:\d{2}:\d{3}).+(\[.{55}])").unwrap();
let string = "03712 -R->13:29:23:265 uRD 778 ReadStat 20,01,00,[OS:T------- OP:----B--- TS:----- - ---** --*---* ****--]01,9a,80,08,0a,13,00,64,7c,00,14,10,11,01,01,00,00,00,00,00,03,00,00,00,00,00,00,c9,21,00,aa,12,11,00,00,10,0a,bb,01,00,03,01,00,00,cc,01,00,01,01,00,00,01,01,dd,08,27,3b,02,00,02,ee,1a,02,80,00,00,ff,00,aa,01,00,03,00,01,00,00,00,rc=00";
// 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/