// 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"(?<imei>[^,]*),(?<gaid>[^,]*),(?<session>[^,]*),(?<action_time>[^,]*),(?<action>[^,]*),'(?<attrs>\{[^']*\})','(?<impressions>[^']*)'").unwrap();
let string = "45235g4tgd3453452,89789dsjfhwf897897fsd9sd,123456789-82638273-92DA5F569,2016-06-12 06:10:03,4000,'{\"ref_action\":\"3000\",\"result\":\"500\",\"pfx\":\"gb\"}','{\"1000\":\"3\",\"34567\":\"14\"}'";
// 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/