21,886
社区成员
发帖
与我相关
我的任务
分享
// $str = stripslashes($str);
$p = '#<.+class=\\\"bar\\\".*>.*<a.*>(.+)<\\\/a>#US';
preg_match_all($p, $str, $result);
$str= <<<str
<div class=\"bar\">\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a target=\"_blank\" id=\"comment_name_460013413\" name=\"comment_name_460013413\" href=\"http:\/\/hz.iiiu.com\/red\/click.php?tp=1&cp=4003694&cpp=1000492&url=http:\/\/weibo.com\/2498716605\">lmlog_001<\/a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a target=\"_blank\" class=\"s_ico\" href=\"http:\/\/hz.iiiu.com\/red\/click.php?tp=1&cp=4004584&cpp=1000492&url=http:\/\/weibo.com\/\">
str;
// 去掉这些多余的转义符,这也应该不是你原始的数据
$str = stripslashes($str);
$p = '#<.+class=\"bar\".*>.*<a.*>(.+)</a>#US';
preg_match_all($p, $str, $result);
var_dump($result[1]);