带有一些参数的preg_replace()标签

时间:2014-12-13 21:12:48

标签: php regex preg-replace

如何删除有的标签(style =“display:none”) 例如,在下面的文字:

  <div style="text-align:center;clear:both;width:100%">
 <img src="http://url"  style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial;">
 <div style="width:100%;display:none">
 <p style="text-align:center;color:#000">blahblah  </p>
 </div></div>
 <p style="text-align: justify;display:none">
 <span>
 <strong style="color:#E02C89">blahblahblahblah </strong></span></p>
 <div style="text-align: center; font-weight: bold;">blahblah</div>

我应该如何移除任何显示的标签并保留其他人

我测试以下模式,但它无法正常工作:

$x = preg_replace ("/<p(.*?)display\s?:\s?none(.*?)>(.*?)<\/p>/is", "", $x);

0 个答案:

没有答案
相关问题