I’ve been trying to find a PHP BB Code parser that fits my website.
Basically I wanted to add paragraph tags to any text (retrieved from a database) not inside a tag (tags like pre+code+blockquote+etc should be left untouched).
My Text in the database would look like this
This is a paragraphThis is another paragraph
as you can see it can spread out over multiple lines, or stay on one line.
This is a paragraph
I found this one
$content = preg_replace('/[^\r\n]+/', "<p>$0</p>", $content);
But this adds p tags inside elements such as pre+code.
Any suggestions on a better solution?Advertisements