Jonathan T. Sage wrote:
$plBody = preg_replace("/<br \/>/", "::ABBA::", $plBody); #Convert all the <br />'s to ::ABBA:: (a rather unlikly string)
$plBody = preg_replace("/<.+?>/", "", $plBody); # Drop all other HTML tags
$plBody = preg_replace("/::ABBA::/", "<br />", $plBody); #Convert all the ::ABBA::'s back to <br />'s
At the risk of going a bit off topic, you may wish to look at PHP's built-in strip_tags function
http://uk2.php.net/manual/en/function.strip-tags.php
$plBody = strip_tags($plBody, '<br>');
But you'll still need to convert plain <br> to <br /> after that, but you can use the slightly quicker str_replace function then
$plBody = str_replace('<br>','<br />',$plBody);
At least this saves you one step without getting any bad disco memories involved...
-- Patrick H. Lauke _____________________________________________________ re·dux (adj.): brought back; returned. used postpositively [latin : re-, re- + dux, leader; see duke.] www.splintered.co.uk | www.photographia.co.uk http://redux.deviantart.com
****************************************************** The discussion list for http://webstandardsgroup.org/
See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list & getting help ******************************************************