// 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)(\(loggingInfo\)|\(beneLoggingInfo\)) - (?<vendorinfo>[^|]*)\|(?<login>[^|]*)\|(?<action>[^|]*)\|(?<timeStamp>[^\|]*)\|(?<tag2>[^\|]*)\|(?<tag6>[^\|]*)\|(?<tag7>[^\|]*)\|(?<tag8>[^\|]*)\|(?<tag9>[^\|]*)\|(?<tag10>[^\|]*)\|(?<tag11>[^\|]*)\|").unwrap();
let string = "18 Jul 2018 09:05:31,068 INFO (loggingInfo) - Auto CRM|ppope|ApplicationLogin|Wed Jul 18 09:05:31 CDT 2018|CSR agent successfully logged in||Successful||||NA|
22 Oct 2018 08:36:41,164 INFO (beneLoggingInfo) - Beneficiary Administration|TESTWHBENE|APPLICATION LOGIN|Mon Oct 22 08:36:41 CDT 2018|User successfully logged in for Client = 070||SUCCESSFUL||||NA|
22 Oct 2018 00:43:23,845 INFO (loggingInfo) - Inquiry Application|TUSER4444|APPLICATION LOGIN|Mon Oct 22 00:43:23 CDT 2018|User successfully logged in for Client : 580||SUCCESSFUL||||NA|
01 Oct 2018 09:29:33,508 INFO (loggingInfo) - ISIS PersonalPlan|TESTOMAR|APPLICATION LOGIN|Mon Oct 01 09:29:33 CDT 2018|User successfully logged in for Client : 002||SUCCESSFUL||||NA|
24 Oct 2018 13:46:07,647 INFO (loggingInfo) - Web-Billing|egunderson| User Authentication|10/24/2018 01:46:07 PM| User Authentication|NA|True| NA| NA| NA| NA|
";
// 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/