How to replace one or two consecutive line breaks in a string?
Something like
preg_replace('/(\r|\n|\r\n){2,}/', '<br/><br/>', $text);
should work, I think. Though I don't remember PHP syntax exactly, it might need some more escaping :-/
preg_replace('/(?:(?:\r\n|\r|\n)\s*){2}/s', "\n\n", $text)