// 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"(?ms)([\w\s]+)\(dir\. ([\w\s]+) \| ([\w\s]+) \| (\d{4}) \| (\d+ min)\)(.*?)((?:\d{1,2} de [a-z]+ \| [\w\-]+ \| \d{1,2}[hH]\s*)+)").unwrap();
let string = "REDENÇÃO
(dir. Roberto Pires | Brasil | 1958 | 61 min)
Newton e Raul, dois jovens rapazes catadores de coco em um bairro pobre de Salvador, dão abrigo a um homem estranho e peculiar que chegou no meio da noite com o carro quebrado. No dia seguinte, os dois saem de casa e deixam o estranho trancado em casa; quando a noiva de Newton chega à casa no período da noite, o estranho tenta atacá-la.
21 de agosto | segunda-feira | 16h
25 de agosto | sexta-feira | 19h
30 de agosto | quarta-feira | 16h";
// 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/