// 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)"28": (true|false)"#).unwrap();
let string = "{\"1\": true, \"2\": true, \"3\": true, \"4\": true, \"5\": true, \"6\": true, \"7\": true, \"8\": true, \"9\": true, \"10\": true, \"11\": true, \"12\": true, \"13\": true, \"14\": true, \"15\": true, \"16\": true, \"17\": true, \"18\": false, \"19\": false, \"20\": false, \"21\": false, \"22\": false, \"23\": false, \"26\": false, \"27\": false, \"28\": false, \"29\": false, \"30\": false, \"31\": false, \"32\": false, \"33\": false, \"34\": true, \"35\": true, \"36\": false, \"37\": true, \"38\": true, \"39\": false, \"40\": false, \"41\": false, \"42\": false, \"81\": false, \"82\": false}";
// 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/