// 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)^https:\/\/(\w{1,}\-\w{1,}\.|\w{1,}\.|www\.|)interpolis\.nl$").unwrap();
let string = "https://acc5-www.interpolis.nl
https://interpolis.nl
https://acc-www.interpolis.nl
https://acc5-cm-www.interpolis.nl
https://acc5-taxateurs.interpolis.nl
https://www.interpolis.nl
https://www.mijnsupersecretinterpolis.nl
https://mijnsupersecret.interpolis.nl
https://mijnsupersecret.interpolis.nl.hackers.ru
https://mijnsupersecret.neppedomeinen.interpolis.nl
https://mijnsupersecret.interpolis.nepdomein.nl";
// 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/