On Fri, Jan 9, 2009 at 11:15, Stephen <stephen-d@xxxxxxxxxx> wrote: > > Thank you! That is the way I will do this. > > I may want to change <br /><br /> to </p><p> but that should be easy. <?php // Convert HTML linebreak tags to paragraph tags. function br2p($str) { $str = preg_replace("/<br\s?\/?>(\r)?(\n)?<br\s?\/?>/Ui","</p>$1$2<p>",$str); return $str; } $str = "This is an example of the use of this function.<br /><br />It should replace only double <br> tags."; echo br2p($str)."\n"; $str =<<<HTML This is another example. If I place any multiple of two <br>, <br />, <BR>, <BR />, <Br>, <Br />, <bR>, or even <bR /> tags side-by-side, they should be replaced with <p></p>. In addition, if there is a newline character in *NIX, Windows, or old-style Mac/Amiga, this will be carried over in the translation. This will ensure preservation of all but the <br /> tags. HTML; echo br2p(nl2br($str)); ?> -- </Daniel P. Brown> daniel.brown@xxxxxxxxxxxx || danbrown@xxxxxxx http://www.parasane.net/ || http://www.pilotpig.net/ Unadvertised dedicated server deals, too low to print - email me to find out! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php