2012-03-16 45 views
0

這些字符串有這樣<text **** display="none">****</text> any words and htmlcodes <text **** display="none">****</text> 我想刪除所有的字符串這樣<text **** display="none">****</text>一文中,首先<text,一端與</text>包含有display="none"我如何的preg_replace使用PHP

+0

http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454 – 2012-03-16 00:11:29

+0

這是格式良好的XML或HTML? – 2012-03-16 00:17:03

回答

0

這個怎麼樣?

$solution = preg_replace("@<text[^>]*display=\"none\"[^>]*>.*?</text>@ims", "", $yourstring);