示例如下:
'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://可能没有

解决方案 »

  1.   


    preg_replace('/^<a\w+\/a>&/',' ',$s);
      

  2.   


     上面不对,试试这个:
     preg_replace('/^<a\s+\w+b>$|<\/a>/',' ',$s);
      

  3.   


     错个字母
     preg_replace('/^<a\s+\w+a>$|<\/a>/',' ',$s);
      

  4.   

    哪有这么简单啊,我是要在@***和http://***加超链接啊
      

  5.   

    100分,给我自己吧!我做出来了    $show =preg_replace('/(?:^|\s)(@([\w]+))/', ' <a href="http://cctv.com/$2"> $1 </a>',$str); 
        $show =preg_replace('/(?:^|\s)((?:http:\/\/|www\.)[a-zA-Z0-9\-\.\/_?&=%]+)/', ' <a  href="$1">$1</a>',$show);