// 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)(?:<w-block-content.*[\s\S]*?<div>)([\s\S]*?)(?:<\/div>((?!<\/div>))*[\s]*?<\/span>[\s\S]*?<\/w-block-content>)").unwrap();
let string = "</tr>
<td>
<div draggable=\"true\" class=\"source master draggable-box wysiwyg-block\" data-block-type=\"master\" data-block-id=\"96e80afb-afa0-4e46-bfb7-34b80da76112\" style=\"opacity: 1;\">
<w-block-content data-block-content-id=\"96e80afb-afa0-4e46-bfb7-34b80da76112\"><span class=\"source-block-tooltip\">
<div>
Další master<br><div><b>Master č. 2</b> </div><br>
</div>
</span></w-block-content>
</div>
</td>
</tr>
</tr>
<td>
<div draggable=\"true\" class=\"source master draggable-box wysiwyg-block\" data-block-type=\"master\" data-block-id=\"96e80afb-afa0-4e46-bfb7-34b80da76112\" style=\"opacity: 1;\">
<w-block-content data-block-content-id=\"96e80afb-afa0-4e46-bfb7-34b80da76112\"><span class=\"source-block-tooltip\">
<div>
Další master<br><b>Master č. 2</b><br>
</div>
</span></w-block-content>
</div>
</td>
</tr>
";
// 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/