// 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"(?s)(?<txt_pre_linka>\w+)?(?<ceo_link><a .*?>.*?<\/a>)(?<txt_after_linka>.*?)(?=<a .*?>.*?<\/a>|$|\.)").unwrap();
let string = "ECSE-4530 Digital Signal Processing
Rich Radke, Rensselaer Polytechnic Institute
Lecture 5: the Fourier Transform (9/11/14)
shsdhsh<a class=\"yt-simple href=\"/watch?v=5HSn3DPHQcQ&t=2s\">0:00:02</a> The Fourier Transform.
Shshshsh<a class=\"yt-simple\" href=\"/watch?v=5HSn3DPHQcQ&t=219s\">0:03:39</a> Thinking ofles of a function
shgshshshs<a class=\"yt-simple\" href=\"/watch?v=5HSn3DPHQcQ&t=463s\">0:07:43</a> Derivim aiod goes to infinity";
// 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/