in reply to Regex help

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:

Replies are listed 'Best First'.
Re^2: Regex help (updated)
by Anonymous Monk on Aug 01, 2018 at 17:26 UTC
    I never understood regex anchors before seeing this very clear example. Next time I won't need 2 regexes :-) Thank you AnomalousMonk