use strict;
my $str = '```html
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>BPA vs. RPA</title>
<style>
table {
width: 80%;
margin: 20px auto;
border-collapse: collapse;
font-family: Arial, sans-serif;
background-color: #f9f9f9;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
th, td {
padding: 15px;
text-align: left;
border-bottom: 1px solid #ddd;
}
th {
background-color: #ff785b;
color: white;
text-transform: uppercase;
}
tr:hover {
background-color: #f1f1f1;
}
tr:nth-child(even) {
background-color: #f2f2f2;
}
</style>
</head>
<body>
<table>
<tr>
<th>Aspect</th>
<th>Manual Collection</th>
<th>API-Based Collection</th>
</tr>
<tr>
<td>Speed</td>
<td>Slow</td>
<td>Fast</td>
</tr>
<tr>
<td>Accuracy</td>
<td>3-4% error rate</td>
<td>Very accurate</td>
</tr>
<tr>
<td>Data Volume</td>
<td>Limited</td>
<td>High capacity</td>
</tr>
<tr>
<td>Cost</td>
<td>Higher (labor)</td>
<td>Lower long-term</td>
</tr>
<tr>
<td>Consistency</td>
<td>Variable</td>
<td>Uniform</td>
</tr>
</table>
</body>
```';
my $regex = qr/(?:```.*\s+|\s+```)/p;
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