use strict;
my $str = 'Accumulated Earnings Tax.
A tax penalty which is imposed on corporate earnings which are retained by the corporation for non-business related needs.
Acquisition Cost.
The expenses incurred by an insurer or reinsurance company that are directly related to putting the business on the books of the company. The largest portion of this cost is usually the agent\'s or sales representative\'s commission or bonus.
Act of God.
An event arising out of natural causes with no human intervention which could not have been prevented by reasonable care or foresight. Examples are floods, lightning, and earthquakes.
Actual Cash Value.
An amount equivalent to the replacement cost of lost or damaged property at the time of the loss, less depreciation. With regard to buildings, there is a tendency for the actual cash value to closely parallel the market value of the property. See also Market Value. ';
my $regex = qr/(Accumulated Earnings Tax\.).+?\n(.*\.)/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