use strict;
my $str = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head></head>
<body>
<a name="top"></a>Back to Category Index</a></p>
<p>-----------------------------------<br/></p>
67)<a name="e1h1" id="e1h1"></a> Summary: Solar Eclipse 2024 Travel
<br/><br/>
<p>Name: laure gem wilson
Roadtrippers
</p>Category: Travel
<br/><br/>
Email: <a href="mailto:query-e1h1@email.net">query-e1h1@email.net</a>
<br/><br/>
Outlet: Roadtrip<br/><br/>
Deadline: 7:00 PM EST - 8 July
<br/><br/>
<p>
Query:
<br/><br/>
Hi, I am on assignment to write a feature about planning a road<br/>trip to experience the Solar Eclipse 2024, including path of<br/>totality, advice about viewing, and recommendations for when and<br/>where to book accommodations, thanks!<br/>
</p>
<p>
Requirements:
<br /><br />
Must be domestic USA<br/>
</p>
<p><a href="#top">Back to Top</a> <a href="#Travel">Back to Category Index</a></p>
<p>-----------------------------------<br/>
';
my $regex = qr/\bEmail:\s*<a\s[^<>]*\bhref="mailto:([^"]+)"/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