import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
public static void main(String[] args) {
final String regex = "Your property ref: 64206_([^\\s]+) .* Message: (.*) Thanks Postcode:";
final String 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_";
final Pattern pattern = Pattern.compile(regex, Pattern.UNICODE_CHARACTER_CLASS);
final Matcher matcher = pattern.matcher(string);
if (matcher.find()) {
System.out.println("Full match: " + matcher.group(0));
for (int i = 1; i <= matcher.groupCount(); i++) {
System.out.println("Group " + i + ": " + matcher.group(i));
}
}
}
}
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 Java, please visit: https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html