// 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)([^-]*)$").unwrap();
let string = "12345-LATIS
234134-CRISE
13241234-P-ORACLE
134134-ORACLE
1341324-ENS
134134-P-NIBS
134123415-LATIS
11513423-CRISE
1-34555
A-33433
12-23434
5-3451-A
";
// 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/