I tried to test your code, by add the following lines, it sayd there were 0 links in the string.
<?PHP
$str = "This is a test string with a <a href=\"#\">link</a>...Heck, it even has <a href=\"#\">another link</a>.";
preg_match_all("/(<a(?:.*?)<\/a> )/i", $str, $matches);
$links = $matches[1]; #$links is an array of all the links.
echo "# of links: " . count($links) . "<br>\n";
echo "Link: " . $links[0] . "<br>\n";
echo "Link: " . $links[1] . "<br>\n";
?>