// 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+-]?[^\s]+\s([^\s\n]+).*$").unwrap();
let string = " +883620946918182db5a277fc5e328fee3030ef79 src/dobot_cr_driver (8836209)
-8fc5c05835a246d7cb46952f748efec11fbf0075 src/onrobot_driver
b5704131f0e2964e4d051d5e6f6560917c2a1969 src/ros_camera
1ffdd69181389b14b7d6342f0c5bad3b45c5e32f src/ur_meta (1.1.5-315-g1ffdd69)
ec2beb65afd6be5373d1e21a86dd42a07e25b447 src/ur_official_driver (v2.0.0-4-gec2beb6)
883620946918182db5a277fc5e328fee3030ef79 src/dobot_cr_driver (8836209)
8fc5c05835a246d7cb46952f748efec11fbf0075 src/onrobot_driver (8fc5c05)
b5704131f0e2964e4d051d5e6f6560917c2a1969 src/ros_camera (heads/develop)
1ffdd69181389b14b7d6342f0c5bad3b45c5e32f src/ur_meta (1.1.5-315-g1ffdd69)
ec2beb65afd6be5373d1e21a86dd42a07e25b447 src/ur_official_driver (v2.0.0-4-gec2beb6)";
// 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/