use strict;
my $str = '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_';
my $regex = qr/Your property ref: 64206_([^\s]+) .* Message: (.*) Thanks Postcode:/p;
if ( $str =~ /$regex/ ) {
print "Whole match is ${^MATCH} and its start/end positions can be obtained via \$-[0] and \$+[0]\n";
# print "Capture Group 1 is $1 and its start/end positions can be obtained via \$-[1] and \$+[1]\n";
# print "Capture Group 2 is $2 ... and so on\n";
}
# ${^POSTMATCH} and ${^PREMATCH} are also available with the use of '/p'
# Named capture groups can be called via $+{name}
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 Perl, please visit: http://perldoc.perl.org/perlre.html