// 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)\"(?<Event_Log>[^\"]+)\""#).unwrap();
let string = "2021-12-04T01:29:48.015524+00:00 USHCO-EXXON, ipsec-ike-down, 689, \"IKE connection with peer 10.218.42.113 (routing-instance EXXON-Control-VR) is up\", USPAB
2021-12-04T01:29:15.007722+00:00 USHCO-EXXON, ipsec-tunnel-down, 687, \"IPSEC tunnel with peer 10.218.42.111 (routing-instance EXXON-Control-VR) is up\", USPAB
2021-12-04T01:29:15.007722+00:00 USHCO-EXXON, ipsec-ike-down, 686, \"IKE connection with peer 10.218.42.111 (routing-instance EXXON-Control-VR) is up\", USPAB
2021-12-04T01:29:14.807814+00:00 USHCO-EXXON, ipsec-tunnel-down, 872, \"IPSEC tunnel with peer 10.218.42.111 (routing-instance EXXON-Control-VR) is up\", USPAB
2021-12-04T01:29:14.807814+00:00 USHCO-EXXON, ipsec-ike-down, 871, \"IKE connection with peer 10.218.42.111 (routing-instance EXXON-Control-VR) is up\", USPAB";
// 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/