现在有这么一大段内容:
$str = "<br><strong><p>......<br /> 
  <object classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="500" height="400"><param name="url" value="VLS_B1U1P2C1AB.wmv" /><param name="autostart" value="false" /><param name="showcontrols" value="true" /> 
  </object></p>......<br />......<br />......<br />......<br />......<br />......<br /></strong><br>";我想把<object ......></object>这段去掉,变成
$str = "<br><strong><p>......<br /></p>......<br />......<br />......<br />......<br />......<br />......<br /></strong><br>";preg_replace('/(<object)+?([^\/])+(</object>)/is', '', $str);用了上面这个之后,后面全部没有了。还有如何学习正则表达式啊,谢谢

解决方案 »

  1.   

    $s = <<<s
    <br><strong><p>......<br />  
      <object classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="500" height="400"><param name="url" value="VLS_B1U1P2C1AB.wmv" /><param name="autostart" value="false" /><param name="showcontrols" value="true" />  
      </object></p>......<br />......<br />......<br />......<br />......<br />......<br /></strong><br>;
    s;
    $s = preg_replace('/<object.*>.*<\/object>/is', '', $s);
    echo $s;
      

  2.   

    “还有如何学习正则表达式啊”多看手册,多练习
    http://www.php.net/manual/en/reference.pcre.pattern.syntax.php