use strict;
my $str = 'Voice Mail Message: Double click on the attachment to play the voice mail file.
Date:
12/01/2014 01:28:36 PM
Number:
800-123-4567, JOHN SMITH
CallerID:
123-456-7890, JANE DOE
Destination:
Voice Mail
File Duration:
00:00:37
======================
Name : Jane Doe
Address : 123 Fake Street , Miami , Florida
Phone : 123-456-7890
Ye, my name is Jane Doe. I own the property at 123 Fake Street , Miami , Florida. You sent me a couple of postcards. Let me know if you\'re interested in making an offer. it\'s a single family home.3 bedrooms, 2 baths. Has a single efficiency in the back, that\'s an additional rental income.
Again, Jane Doe and that\'s 123 Fake Street and my phone number is 123-456-7890. Thanks !
';
my $regex = qr/CallerID:\n([0-9\-\s\.]+)/ismp;
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