I don't use ereg. I stopped a while back, I use preg_ instead because it's more powerful IMHO.
To catch an href:
$regex='/<a\s+[>]\shref=((\'[\']\')|("["]")|([a-z0-9_]+))(>|([>]*>))/i';
if(preg_match_all($regex,$string,$matches)){
//you take it from here on the $matches array:
echo "<pre>";
print_r($matches);
}
May surprise you that a regex could be that complex but:
1. there's no requirement that the href=... be right after the <a..
2. though not all the best, any of these are kosher:
href='text in singles, "word dude" '
href="text in doubles"
href=solid_text_with_no_spaces
To test regex's, go to my tester, it's the best out there:
http://www.samuelfullman.com/team/php/tools/regular_expression_tester_p.php
You can even test code in remote pages, and there's docs.
I love regex's couldn't survive without them anymore.