// 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"(?i)(?=_{20,}|From:|On\s\w{3},\s\w{3}\s\d{1,2},\s\d{4}\sat\s\d{1,2}:\d{2})").unwrap();
let string = "Great thank you
________________________________
From: Blake <blake@foursocial.uk>
Sent: Saturday, August 31, 2024 9:46:12 AM
To: blake hoang <bjh2004@hotmail.co.uk>
Subject: Re: Ignition. Campaign
Thanks , yes we can do it
---
Blake Junior
Managing Director | Foursocial.
blake@foursocial.uk<mailto:blake@foursocial.uk>
Submission Links<https://linktr.ee/foursocial1>
[https://ci3.googleusercontent.com/mail-sig/AIorK4yeSFbHM5imdVzOjDTr7LwNvS9gqpyQ83uajylr7mDBuRn5ymG1jlev6Zz8vvgQMzDLAYjFLcR7LVLu]
On Sat, Aug 31, 2024 at 9:45 AM blake hoang <bjh2004@hotmail.co.uk<mailto:bjh2004@hotmail.co.uk>> wrote:
Hey there let me know the fee";
// result will be a tuple containing the start and end indices for the first match in the string
let result = regex.captures(string);
let (start, end) = match result {
Some((s, e)) => (s, e),
None => {
// ...
}
};
println!("{}", &string[start, end]);
}
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/