// 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+$\n").unwrap();
let string = "278
00:15:13,442 --> 00:15:14,436
Mr. Burns,
279
00:15:14,454 --> 00:15:17,893
I came here because my brother
is about to be wrongfully convicted,
280
00:15:17,947 --> 00:15:19,514
and the man I'm looking for
281
00:15:19,542 --> 00:15:21,010
would help me find the truth.
282
00:15:21,038 --> 00:15:21,907
Don't you get it?
283
00:15:21,932 --> 00:15:23,918
I don't care who you are
or what you want.
284
00:15:25,167 --> 00:15:26,801
Now get lost.
285
00:15:29,102 --> 00:15:31,170
I think you just sent away
the first person
";
// 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/