Note that parsing (X|HT)ML with regexes is fragile; you'd do better to use an XML parser, about which others can advise better than I. However:
c:\@Work\Perl\monks>perl -wMstrict -le "use 5.010; ;; use Data::Dump qw(dd); ;; my $s = '<tr><td>99</td></tr><h3><table><tr>BBBBB 01/08/2018</h3>' . '<td>236</td><td>002</td><td>121</td><td>266</td></tr>' . '<tr><td>999</td><td>9999</td></tr>' ; print qq{[[$s]] \n}; ;; my @n = $s =~ m{ (?: BBBBB [^>]+ > | \G) <td> (\d+) </td> }xmsg; dd \@n; " [[<tr><td>99</td></tr><h3><table><tr>BBBBB 01/08/2018</h3><td>236</td> +<td>002</td><td>121</td><td>266</td></tr> <tr><td>999</td><td>9999</td></tr>]] [236, "002", 121, 266]
Update: A few afterthoughts:
Give a man a fish: <%-{-{-{-<
In reply to Re: Regex help (updated)
by AnomalousMonk
in thread Regex help
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |