Return to Snippet

Revision: 37898
at December 23, 2010 01:55 by iloveitaly


Updated Code
function paragraph_trim($content) {
	$result = preg_replace('!(^(\s*<p>(\s|&nbsp;)*</p>\s*)*|(\s*<p>(\s|&nbsp;)*</p>)*\s*\Z)!em', '', $content);
	return $result === NULL ? $content : $result;
}

Revision: 37897
at December 19, 2010 15:16 by iloveitaly


Initial Code
function paragraph_trim($content) {
	return preg_replace('!(^\s*<p>(\s|&nbsp;)*</p>\s*|<p>(\s|&nbsp;)*</p>\s*$)!', '', $content);
}

Initial URL

                                

Initial Description
Useful for preparing content generated by CKEditor

Initial Title
Trim Empty Paragraph Tags at Beginning & End of String

Initial Tags

                                

Initial Language
PHP