in reply to Regexp to extract HTML link data

Your problem isn't well defined. How much variation can there be? If you have to support all HTML possibilities, you'd be much better of using a parser.

Anyway, here's an untested attempt. Most likely, it breaks on your second example:

my (undef, $new, $hit) = $in =~ m{ <td><img \s+ src \s* = \s* (["']) foo[.]jpg \1 > (<a \s+ href \s* = (["']) [^"']* \4 > [^<]* </a>}ix;

Abigail