As far as I can see, your regex pattern shouldn't match that candidate string at all because there's no "@" symbol in the candidate string. In fact your regex pattern looks like a rudimentary email detection pattern. Try this instead:
http:\/\/(www.)?[a-zA-Z0-9\-_.]+\.[a-zA-Z]{3,4}
Tested and verified with following code.
PHP Code:
$haystack = "<a href=\"http://www.google.com\">Link to Google</a>";
ereg("http:\/\/(www.)?[a-zA-Z0-9\-_.]+\.[a-zA-Z]{3,4}", $haystack, $result);
if( $result )
echo $result[0];
else
echo "Fail!";
All web designers hate the internet. If I spend all day making/updating/looking at websites, why the hell would I want to deal with it outside of work?