/<sohu*<\/sohu/i  
===>
/<sohu.*<\/sohu/i

解决方案 »

  1.   

    /<sohu.*<\/sohu/i
    这样还是不行
    /<sohu.[^<]*<\/sohu/i
    这样才行不知为什么?
      

  2.   

    /<sohu_cms_include:.*<\/sohu_cms_include>/
      

  3.   

    /<sohu_cms_include:(.*)<\/sohu_cms_include>/Ui
      

  4.   

    都不行啊!
    $ttt =<<< eof
    test
    <sohu_cms_include:learning_articlefrag1><p align=center><a href=http://2004.sports.sohu.com/ target=_blank><font color=red><b>搜狐奥运王者归来,七种武器谁与争锋</b></font></a> <a href=http://2004.sports.sohu.com/ target=_blank><img src="http://photo.sohu.com/20040809/Img221437781.gif"  height="10" border=0></a></p> </sohu_cms_include>
    eof;
    echo $opf = preg_replace("/<sohu[.\n]*<\/sohu/i","",$ttt);
    结果还是老样子.
      

  5.   

    上面代码不对
    $ttt  =  <  <  <  eof  
    test  
    <sohu_cms_include:learning_articlefrag1>
    <p  align=center  >
    <a  href=http://2004.sports.sohu.com/  target=_blank  >  <font  color=red  >  <b  >搜狐奥运王者归来,七种武器谁与争锋  </b  >  </font  >  </a  >   <a  href=http://2004.sports.sohu.com/  target=_blank  >  <img  src=  "http://photo.sohu.com/20040809/Img221437781.gif  "    height=  "10  "  border=0  >  </a  >  </p  >    
    </sohu_cms_include>  
    eof;  
    echo  $opf  =  preg_replace(  "/  <sohu[.\n]*  <\/sohu/i  ",  "  ",$ttt);  
    里面包含\n的情况所以要[.\n],但就是不行!
      

  6.   

    .本来就不匹配\n,
    在PHP中可以通过/s来使它匹配
      

  7.   

    对的,用s模式
    echo $opf = preg_replace("/<sohu(.*)<\/sohu/s","",$ttt);
      

  8.   

    不用s模式就象cloudchen(cloudchen) 那样