// 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):\/\/(?!(.+\.)?(meinedomaineins\.de|meinedomainzwei\.de)).+\.php").unwrap();
let string = "http://www.fremdedomain.de/index.php soll gefiltert werden
http://www.meinedomaineins.de/index.php soll durchkommen.
http://www.meinedomainzwei.de/index.php soll durchkommen.
<a href=\"https://www.nochirgendeinedomain.com/site/redirect.php?url=https%3A%2F%2Fwww.irgendeinedomain.com%2Fde%2FFsubmit%2F1%2F&utm_source=DE_BB_2017Q3&utm_medium=email&utm_campaign=allg&utm_content=rebox_ancillary\">
";
// 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/