Hello,

I'm trying to write a RegExp that will match 1 appearance of \n (new line) to replace it with <br />\n (the new line here is for the source for to have line break also, not a endless characters in one line), and will match more than 1 appearance of \n to replace with </p>\n<p>.
I wrote this thing to test it with a simpler result:
Code:
$lines=array(
	"/(^|[^d])d($|[^d])/" => "Ad",
	"/[d]{2,}/" => "BdC"
);
$str=preg_replace(array_keys($lines), array_values($lines), $str);
Works as expected:
Code:
$str="d" -> "Ad", $str="dd" -> "BdC", $str="ddd" -> "BdC"
How can I edit the RegExp to match it with new lines?