I am using preg_replace to replace two line breaks with p tag. See code below. The problem I am getting is that for some of the text it put empty p tags and I can't figure out whats wrong with my code.
Can you please have a look and let me know if you can fix it.
<p><![CDATA['.contentXMLParse('content goes here').']]></p>
$content = trim($content);
$output = preg_replace('/\n\r|\r\n|\n\n|\r\r/', "]]></p><p><![CDATA[", $content);