// 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"(?mi)(On\s.*<\n){0,1}(.*\n(\n){0,1}((^>+\s?.*$)+\n?)+)").unwrap();
let string = "test comment reply in email
On 10.05.2016 16:06, MRKTNG wrote:
> New Message
> MRKTNG <#>
>
> Your Profile Picture
>
> Lisa Radzishevsky <#>
> May 10, 2016, 8:06 am
>
>
>
>
>
> RE: Language learning
>
> test subject
>
>
> Reply
> <http://mandrillapp.com/track/click/30047086/vendori.local?p=eyJzIjoiLXVwS2lWRndOUXVibWozbmFVQ09qbVE3ZVdjIiwidiI6MSwicCI6IntcInVcIjozMDA0NzA4NixcInZcIjoxLFwidXJsXCI6XCJodHRwOlxcXC9cXFwvdmVuZG9yaS5sb2NhbFxcXC9kb2N1bWVudFxcXC80ODEwNCNkaXNjdXNzaW9uXCIsXCJpZFwiOlwiY2YwYWFhNWE1ZWY5NDZmMDhlNjJmNmRiMTAyZDY4Y2VcIixcInVybF9pZHNcIjpbXCJhYzE1OWI2NTM2YTM0ZDkzYmU1MzE5Y2VmN2IzOWEwZGQzMjY2NWRkXCJdfSJ9>
>
>
> © 2015 MRKTNG. All Rights Reserved.
> 1 W Superior St. • Chicago • IL 60654 USA <#>
>
";
// 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/