Replacing "/[^>][\n\r]+/" with "<br />\n"

ribchr00_at_stud.unibas.ch
Date: 02/28/05


Date: 28 Feb 2005 00:49:55 -0800

Hi all,

I would like to replace line breaks such '[\n\r]+' with '<br />'. Easy
task. Problems start when I try to only replace lines that do not end
with HTML tags.
I tried preg_replace("/[^>][\n\r]+/", "<br />\n") but this does not
seem to work.
An example to better understand what I would like to achieve:

first line
<title>Title</title>
third line

should give:

first line<br />
<title>Title</title>
third line<br />

Any help would be grateful appreciated. Thanks and have a nice day,

christian