header('Content-Type:text/html;charset=utf-8'); $string = '<a href="http://www.baidu.com">百度</a> <a href="http://www.sina.com.cn">新浪</a>'; $preg = '/href="(.*?)">/'; preg_match_all($preg, $string, $matches); var_dump($matches);