I have a problem: I am using TinyMCE for a text field. It all works fine until a user hits the enter button some times at the end of h开发者_开发技巧is input (new lines that are not needed). So for some inputs I save
<p>CONTENT</p><p> </p><p> </p>
or
<p>CONTENT</p><br /><br />
Since this input is displayed at other places of the webpage in a certain design, the trailing empty paragraphs and breaklines can trash the layout.
So I am looking for a way to check wheter these empty tags exists at the end of a string in PHP to remove them (for previously created entries) and if possible, I would like to configure TinyMCE to not allow such tags at all (not as important as the PHP solution).
Does anyone have an idea on how to do that? I can find/replace all empty paragraphs but this is too hard since users are using them to create gaps between their inputs. I really just want to find the trailing ones.
(<p> </p>|<br />)+$
精彩评论