in reply to matching links in a web request

I'd try to match all links, and later filter them.

For the URLs you could use Regexp::Common::URI, or something like this regex:

m#\<a href="([^"]+)"\>(.*?)\</a\>#

Alternatively you could use a module to parse the HTML, maybe that would simplify things.