// 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){[^}{]*?\[PPD\](?:FV5003|PP2340|AG7698)_[^}{]*},").unwrap();
let string = "{
\"valueSource\": \"opc\",
\"opcItemPath\": \"ns\\u003d1;s\\u003d[PPD]FV5003_HOA.State.IO_Open\",
\"dataType\": \"Boolean\",
\"name\": \"IO_Open\",
\"tagType\": \"AtomicTag\",
\"opcServer\": \"Ignition OPC UA Server\"
},";
// 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/