// 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"access-list.*\b(?<src>\d+\.\d+\.\d+\.\d+).*\-\>.*\b(?<dst>\d+\.\d+\.\d+\.\d+)").unwrap();
let string = "2011-04026T19:10:17-06:00 ant-fw : %ASA-4-106023: Deny tcp src inside:192.1.1.102/3191 dst outside:204.1.1.28/443 by access-group \"inisde\" [0x0,0x0]
2011-04026T19:28:24-06:00 ant-fw : %ASA-4-106100: access-list dmz permitted udp dmz/10.1.1.20(123) -> outside/91.1.1.4(123) hit-cnt 1 first hit [0x7f55f1d2, 0x0]
";
// 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/