Regular Expressions
The only thing you are missing is a delimiter in your regexp pattern. I believe this can be any character; a common choice is a forward slash. But then of course you must escape your existing forward slashes. Here are two examples, using forward slash and right square bracket.
$text = preg_replace('/
/', '
', nl2br($text), 1);
$text = preg_replace(']
]', '
', nl2br($text), 1);