// 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"(?U)Your property ref: 64206_([^\s]+) .* Message: (.*) Thanks Postcode:").unwrap();
let string = "Overseas enquiry from Jacqueline Surname via Zoopla Property Group Overseas enquiry from Jacqueline Surname via Zoopla Property Group You have a new enquiry provided by Zoopla Property Group Don't miss a lead! Add this email address to your address book members@zpg.co.uk Zoopla Property Group Zoopla Property Group Buyer enquiry To view all your leads login to ZooplaPro today. *Dear team at Algarve Team Properties Lda*, You have a new Overseas enquiry Name: Jacqueline Surname Telephone: 000000 761232 Email: email@gmail.com About: I am looking to invest Type of enquiry: Request property details Unique Reference: listing_53927960_64206 Your property ref: 64206_ATP350A1 Address: Albufeira, Algarve, Portugal Message: What are the condominium fees for this property please? Thanks Postcode: PO6 2UJ 1 bed property for sale *€110,000 * - _1 bed property for sale_ Albufeira, Algarve, Portugal Clube Albufeira Resort Lovely 1st floor T1 apartment, in a superb area in one of Albufeira’s premier complexes, just outside the lively ... _View more details_";
// 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/