// 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)appDesc\"\s:\s\"(?<appDesc>[^\"]+)"#).unwrap();
let string = "2023-05-02 22:27:20,100 | info application status https:www.codeurl
[
Response: 200 ok- https:www.codeurl
\"appDesc\" : \"User not within error limit\"
{
\"appcd\" : \"0\",
\"appDesc\" : \"fraud app dected risk tolerance\"
} ],
2023-05-02 22:27:20,100 | info application status https:www.codeurl
[
Response: 200 ok- https:www.codeurl
\"appDesc\" : \"User not within error limit\"
{
\"appcd\" : \"0\",
\"appDesc\" : \"fraud app dected risk tolerance\"
} ],";
// 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/