phranque - 9:58 am on Feb 8, 2012 (gmt 0)
the closing paragraph tag isn't required for validation in HTML (4 or 5) but is required in XHTML.
if the </p> is missing it will be implied by the opening tag of the next block-level element.
therefore you only need it if you want to validate for XHTML or if there isn't a new block level element where you need one.
i prefer to use the </p> tag in all cases to avoid ambiguity and future maintenance headaches.
one possible solution is to use your intended pattern for finding the space between paragraphs and replace the \r\n with </p><p class=... and then add the opening and closing paragraph tags to the beginning and end of the entire text block.