use strict;
my $str = 'Hi,
Congrats, your offer on a Ford Ka for the price of £2,000.00, was the winning offer!
Car Details
Ford Ka
Model: Ford Ka
Reg: LN61XVW
Fee: £229.0
Distance: 32 miles
Mileage: 28709
Car age: 13
Colour: BLACK
See customer details
You’ll need to find a time that’s right for both parties so you can inspect the vehicle and make sure it looks as good as advertised.
Ask us to collect for you or pick it up yourself and arrange payment with the seller.
Customer Contact Details
Name: Donna Irwin
Phone: +447884015643
Email: donna.irwin@btinternet.com
Postcode: AL1 2ET
Follow the link below to get in touch and exchange details.
Contact the seller here
Use the help link below if you have any questions.
Happy Hunting,
The Carwow Team';
my $regex = qr/Reg: Email:/mp;
if ( $str =~ /$regex/g ) {
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