<?php
$str = ' <a href="/">link</a><span>span</span> <a href="/2">link</a><script type="text/javascript">script</script> <a href="/">link</a> ';
if(preg_match_all('/<a.*?href="(.*?)".*?>/', $str, $match)){
echo '<pre>', print_r($match[1], true), '</pre>';
}
вариант