// 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)facilityAlias\":\"(?<facility>[^\"]*)"#).unwrap();
let string = "sample log: 2023-01-02 23:36:58,521 [[MuleRuntime].uber.3869: [abcd-message-kdhskhdsk-api].Delete_msg_from_queue.BLOCKING @27fe0275] INFO com.skdhksh.jsdhjshd.hsd.logging.internal.CustomLoggerOperations - {\"environment\":\"stag36rcf_eu-env\",\"applicationName\":\"abcd-message-kdhskhdsk-api\",\"correlationId\":\"kshddhks-3o4u-jshd8-aksdbkadkahd\",\"apiProcessingTime\":347,\"totalProcessingTime\":740,\"tracePoint\":\"END\",\"logMessage\":\"{\\n \\\"url\\\": \\\"abcd\\\",\\n \\\"bucketName\\\": \\\"dipeus-data-store\\\",\\n \\\"s3versionID\\\": \\\"shdkshdkshdkshdkshdkshdkjshd\\\",\\n \\\"s3key\\\": \\\"ljdljdlajldj]dsdsd\\ksdjksjdksjdksjdksjksjd\\ksdjksjd\\\"\\n}\",\"txnMetadata\":{\"bundleId\":\"ahsdkhsdh-skjdhshdkshd-skdhshdks-skdhkshd\",\"messageType\":\"abcd\",\"messageSubType\":\"kdshdkshdks\",\"facilityAlias\":\"Parc de Salut Mar Barcelona\",\"systemName\":\"CMPSB\",\"transactionStartTime\":1672702617781,\"relatesToPatientMerge\":false,\"inputPayload\":\"adhkjshdkshdkshdkshd\"},\"apiStartTime\":\"1672702618174\"}";
// 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/