// 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"(\w+)").unwrap();
let string = "\"1 2013-07-25 11599\" CLOSED
\"2 2013-07-25 256\" PENDING_PAYMENT
\"3 2013-07-25 12111\" COMPLETE
\"4 2013-07-25 8827\" CLOSED
\"5 2013-07-25 11318\" COMPLETE
\"6 2013-07-25 7130\" COMPLETE
\"7 2013-07-25 4530\" COMPLETE
\"8 2013-07-25 2911\" PROCESSING
\"9 2013-07-25 5657\" PENDING_PAYMENT
\"10 2013-07-25 5648\" PENDING_PAYMENT
\"11 2013-07-25 918\" PAYMENT_REVIEW
\"12 2013-07-25 1837\" CLOSED
";
// 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/