日期:2014-05-17 浏览次数:20527 次
<body>
<a href="/news/news-list.php?id=5">标题名称</a>
<a
href="
/news/news-list.php?id=6">标题名称</a>
<a class="bds_qzone"></a> <a class="bds_tsina"></a> <a class="bds_tqq"></a> <a href="/news/news-list.php?id=7">标题名称</a>
</body>
preg_match_all('/<a(?:[\s\S]*?)href\s*?=\s*?[\'"](((?:http(?:s?):\/\/)?([^\"\'\/]+))?(?:[^\"\']*))[\'"](?:[^>]*?)>([\s\S]*?)<\/a>/i'
$s=<<<html
<body>
<a href="/news/news-list.php?id=5">标题名称</a>
<a
href="
/news/news-list.php?id=6">标题名称</a>
<a class="bds_qzone"></a> <a class="bds_tsina"></a> <a class="bds_tqq"></a> <a href="/news/news-list.php?id=7">标题名称</a>
</body>
html;
preg_match_all('/<a[^>]+href="(.+)"[^>]*>(.+)<\/a>/isU',$s,$m);
print_r($m);