// 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#"endpointKeyHash\":\{\"string\":\"(?<endpointKeyHash>[^\=\"]*)"#).unwrap();
let string = "2641328 [EPS-log-dispatcher-11] INFO 1.24978294676695149906 - {\"Log Header\": \"{\"endpointKeyHash\":{\"string\":\"MAz7MadOhr02tPt5vtZsSEy9FWw=\"},\"applicationToken\":{\"string\":\"24978294676695149906\"},\"headerVersion\":{\"int\":1},\"timestamp\":{\"long\":1495594584490},\"logSchemaVersion\":{\"int\":2}}\",\"Event\":{\"temperature\":-1,\"timeStamp\":1495594583638}}";
// 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/