// 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)(?s)(\G|<p class="oyric">)((?!</p>).)*?\K((?<=>)\h+|\h+(?=<|\h))"#).unwrap();
let string = " <div align=\"justify\">
<table width=\"552\" border=\"0\">
<tr>
<td><h1 class=\"article\" itemprop=\"name\">Modals</h1></td>
</tr>
<tr>
<td class=\"text_dreapta\">On February 25, 2011, in <a href=\"modals.html\" title=\"View all articles from Modals\" class=\"external\" rel=\"category tag\">Destiny</a>, by Roland Worrior</td>
</tr>
</table>
<p class=\"text_obisnuit2\"><em>Should I stay or should I go?</em></p>
<p class=\"oyric\"> Laurie Strode comes to her final confrontation with Michael Myers, the masked figure who has haunted her since she narrowly escaped. </p>";
// 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/