// 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"failing[\w\W]*?\d*\)\s[\w\W]*?\:[\s\S]*?(Assert[\w\W]*?)[\n].*(src[^:]+):(\d+):(\d+)").unwrap();
let string = " 1) validates input
0 passing (660ms)
1 failing
1) statement:propose validates input:
AssertionError: expected { Object (status, err) } to have a deep property 'err' of 'err1', but got 'Error while fetching the changes from the event store: {}'
at doAsserterAsyncAndAddThen (node_modules/chai-as-promised/lib/chai-as-promised.js:307:16)
at .<anonymous> (node_modules/chai-as-promised/lib/chai-as-promised.js:255:21)
at ctx.(anonymous function) [as property]
at src/aggregate/index.js:144:100
(node_modules/chai/lib/chai/utils/overwriteMethod.js:49:33)
at Context.<anonymous> (src/aggregate/test/index.js:44:36)
";
// 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/