// 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"(?:[^,]*,){52}(?<host>\w+)").unwrap();
let string = " Feb 15 10:21:05 test01pano.xxxxxx.com 1,2018/02/15 10:21:05,012501001022,TRAFFIC,end,1,2018/02/15 10:21:04,10.x.x.x,10.x.x.x,0.0.0.0,0.0.0.0,DXXXXX_not_here,,,ssl,vsys2,Data-Center-Admin,Data-Center-Core,ae5.2005,ae5.250,pan_log_forward,2018/02/15 10:21:04,69938101,1,44400,9080,0,0,0x100053,tcp,allow,xxxx,xxxx,xxxx,22,2018/02/15 10:20:40,22,not-resolved,0,6486906217785415243,0x8000000000000000,10.0.0.0-10.x.x.x,10.0.0.0-10.x.x.x,0,12,10,tcp-rst-from-client,19,0,0,0,Data_Center,dwest01fw,from-policy,,,0,,0,,N/A";
// 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/