in reply to Re^2: Regex keep matching the last possible match (but should get all)
in thread Regex keep matching the last possible match (but should get all)

Maybe re-consider the advice initially offered by Corion about using a real HTML parser for HTML parsing.

Definitely. In 20 years of writing Perl, I've written a lot of long, ugly regexes to pull data out of HTML files as a one-time, quick-and-dirty solution. But I wouldn't count on any of them to be reliable enough to use repeatedly or for automated purposes. For anything reliable, use a module that won't break the day someone changes <TD> to <td> or rearranges a couple of tags.

If the assignment says to do it with a regex, then that's what you do. But in a real-life parsing task, there's usually a better way.

Aaron B.
Available for small or large Perl jobs and *nix system administration; see my home node.