preg_replace question
| From: | Armand Turpel | Date: | Sat, 20 Sep 2003 15:21:13 +0000 |
| Subject: | preg_replace question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-163295@lists.php.net to get a copy of this message | ||
I need the following replace function:
Replace all line breaks to <br> but not if a line break comes after an </h1>
or </h2> or .... </hx>
Currently I use this preg_replace but it's not good enough for all
situations.
$text = preg_replace("/([^\<][^\/][^h][^1-9].{1})\r\n/","\\1<br
/>",$text);
????
Thanks