2012/01/31日 更新:
匹配手机以及电话号码 重新修改,可支持18开头的手机号,并修改bug,可匹配出字符串中所有匹配号码!
经过多次测试,以下代码可以实现邮箱、链接地址和电话号码的匹配
匹配全部url地址和链接内容
====================
$str = "<a href='http://www.baidu.com' target='_blank'>百度</a>http://www<a href='http://www.sina.com' target='_blank'>新浪</a>kod";
preg_match_all("/<a href=([\"\'])(http:\/\/([\w\d\.])+)[^>]*>(.*?)<\/a>/i", $str, $matches);
echo "<pre>";
var_dump($matches[2]);
echo "<br />";
var_dump($matches[4]);
匹配邮箱
==========&#