// 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)transactionId=(?<transactionId>.*?)}.*ResourceId:\s(?<featureName>.*?),.*CPNYID_(?<companyId>\d+)_AID_(?<aPaymentId>\d+)").unwrap();
let string = "2020-Apr-10 09:32:50.086 PDT [pool-4-thread-1] INFO com.adp.taxmod.lock.service.NTLockServiceImpl {createdDate=Fri Apr 10 09:32:49 PDT 2020, id=4-699211, transactionId=3746ddf0-e602-409b-831c-d0cd995c5595} - NTLockServiceImpl : acquireLock() - ResourceId: CREDIT_RECONCILE, ResourceType: {} CPNYID_25817065_AID_996";
// 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/