// 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#"<li style="display: list-item;" class="mc-container"><a href="([^"]+)".*?data-querystring="id=(\d+)".*?<img src="([^"]+)".*?<a[^>]+>([^<]+)</a>"#).unwrap();
let string = "<li style=\"display: list-item;\" class=\"mc-container\"><a href=\"http://youpeliculasweb.com/cantinflas-2014\" title=\"Cantinflas 2014 (2014) PelÃcula Online\"><div class=\"tool mc-item\"><div class=\"info_movie tile\" data-tipped=\"http://youpeliculasweb.com/cantinflas-2014/info\" data-querystring=\"id=4303\"><div class=\"play_go\"></div><img src=\"http://img-youpeliculas.com/images/2014/09/09/Cantinflas2B20142Bonline.jpg\" alt=\"Cantinflas 2014 (2014) PelÃcula Online\"></div></div></a><div class=\"library-show\"><h4><div class=\"title-overflow\"></div><a class=\"title\" href=\"http://youpeliculasweb.com/cantinflas-2014\" title=\"Cantinflas 2014 (2014) PelÃcula Online\">Cantinflas 2014</a></h4></div></li>";
// result will be a tuple containing the start and end indices for the first match in the string
let result = regex.captures(string);
let (start, end) = match result {
Some((s, e)) => (s, e),
None => {
// ...
}
};
println!("{}", &string[start, end]);
}
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/