// 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)(\d+)\s*-\s*(.*?)(?=;\s*\d|$)").unwrap();
let string = "12 - ksjksu,nsusi,9018,1.00uy,9.0Vm,+/ - 20%(0.22suns); 891- 1o19jsksuisolslskosBN
205 - lksiosslsoujhs%ysus(0.33mismsn);31 - jsks,msnu
22 - 0204 - 2762.0uhsyuskis;14 - gnshj,msuis,lsolso2.2n; 67181 - iuwuwiwi
";
// 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/