示例如下:
'First Blood @yoiudfa Triple kill http://www.csdn.net/hehe beyond the god' 匹配后
'First Blood <a href="http://cctv/yoiudfa">@yoiudfa</a> Triple kill <a href="http://www.csdn.net/hehe">http://www.csdn.net/hehe</a> beyond the god'
@和http://可能没有
'First Blood @yoiudfa Triple kill http://www.csdn.net/hehe beyond the god' 匹配后
'First Blood <a href="http://cctv/yoiudfa">@yoiudfa</a> Triple kill <a href="http://www.csdn.net/hehe">http://www.csdn.net/hehe</a> beyond the god'
@和http://可能没有
preg_replace('/^<a\w+\/a>&/',' ',$s);
上面不对,试试这个:
preg_replace('/^<a\s+\w+b>$|<\/a>/',' ',$s);
错个字母
preg_replace('/^<a\s+\w+a>$|<\/a>/',' ',$s);
$show =preg_replace('/(?:^|\s)((?:http:\/\/|www\.)[a-zA-Z0-9\-\.\/_?&=%]+)/', ' <a href="$1">$1</a>',$show);