// 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)\[div(?:\sid=["|'](.*?)["|'])?(?:\sclass=["|'](.*?)["|'])?\](.*?)\[\/div\]"#).unwrap();
let string = "sdfsdfsd
adafadfalkjdafdfa
[div id=\"bla\" class=\"ups\"]some multiple line text[/div]
[div class=\"bla\"]some multiple line text
more lines
[/div]
[div id=\"first\"]
some text
[/div]
Ovo ne bi trebalo da fatga
[div id=\"bla\"]
On the other hand, and in terms of severity, **DNS or NS takeovers** are less common but create the highest impact. An NS subdomain takeover is similar in principle to other types of subdomain takeovers. And due to the major role that NS records play in internet traffic, and the possibility of attackers chaining multiple attack vectors, an NS takeover can lead to severe implications for the target organization.
*For our new blog series [Blast Radius][4], security professionals, researchers and experts deep dive into different attacks and vulnerabilities, explore how they can impact the entire internet ecosystem, and examine what they mean for organizations of all sizes, across all industries. To talk about the growing danger of DNS takeovers, we are joined by Patrik Hudák.*
poop
[/div]
adfadfadfadfaf";
// 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/