// 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"\[(?:\d\.\d*(?:E-\d+)?)(?:, (?:\d\.\d*(?:E-\d+)?))*\]").unwrap();
let string = "[[[0.6453525160688715, 0.15620941152962334, 0.1874313118193626, 9.991008092716556E-5, 9.991008092716556E-5, 9.991008092716556E-5, 9.991008092716556E-5, 0.01050721017750691, 9.991008092716556E-5], [0.5904776610141782, 0.18175460267577365, 9.991008092716556E-5, 0.22716827582448523, 9.991008092716556E-5, 9.991008092716556E-5, 9.991008092716556E-5, 9.991008092716556E-5, 9.991008092716556E-5]]]";
// 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/