use strict;
my $str = '<Entry>
<Type>Unknown</Type>
<DateTime>11/28/2017 11:19:49.652</DateTime>
<Level>Exception</Level>
<Host>CNTX-PROD-WEB-A</Host>
<ThreadID>139</ThreadID>
<Request.URL>https://bonnier.magazine-services.net:44314/CS/Account.aspx?accountid=3622083</Request.URL>
<Comment>Subscript =3420512 - Has an invalid state. The publication is ceased, but the subscription is not canceled.</Comment>
<ExceptionMessage>Issue with subscription: 3420512</ExceptionMessage>
</Entry>
<Entry>
<Type>Unknown</Type>
<DateTime>11/28/2017 11:19:49.652</DateTime>
<Level>Exception</Level>
<Host>CNTX-PROD-WEB-A</Host>
<ThreadID>139</ThreadID>
<Request.URL>https://bonnier.magazine-services.net:44314/CS/Account.aspx?accountid=3622083</Request.URL>
<Comment>Subscript =3420512 - Has an invalid state. The publication is ceased, but the subscription is not canceled.</Comment>
<ExceptionMessage>Issue with subscription: 3420512</ExceptionMessage>
</Entry>
<Entry>
<Type>Unknown</Type>
<DateTime>11/28/2017 11:19:49.652</DateTime>
<Level>Exception</Level>
<Host>CNTX-PROD-WEB-A</Host>
<ThreadID>139</ThreadID>
<Request.URL>https://bonnier.magazine-services.net:44314/CS/Account.aspx?accountid=3622083</Request.URL>
<Comment>Subscript =3420512 - Has an invalid state. The publication is ceased, but the subscription is not canceled.</Comment>
<ExceptionMessage>Issue with subscription: 3420512</ExceptionMessage>
</Entry>';
my $regex = qr/<Entry>((?!<\/Entry>).)*<\/Entry>/sp;
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