问题
What character does tinyMCE put in between empty p tags.
I have the following empty p tags:
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
Which I'd like to remove... but they are not recognized by str_replace or preg_replace. The best I could do to track down the issue, is the space between the tags. In other words I can remove the
<p>
by itself or the
</p>
... but when I try searching for
<p> </p>
it doesn't find it.
Tried
or
 
I found many solutions online but NONE work. It seems the character in question (the space between the p tags) is different or somehow not recognized. I say this because I tried the following
str_replace(" ", "", $html);
All of the other spaces in the string got deleted... EXCEPT for the space between the p tags.
回答1:
It is probably some non-printing unicode character of some type. \s
or maybe \pS
.
preg_replace("@<p>[\pZ\pC]*</p>@u", "", $string);
来源:https://stackoverflow.com/questions/22869608/unrecognized-character-between-empty-p-tags-tinymce