Hi,
In a script to adjust user-inputted text to html text, I am looking for a way to insert paragraphs properly.
I now replace all linebreaks with <br /> through nl2br. From there I g to </p><p> by matching double <br /> in the text.
Now i have the problem that there might be a lot of -newlines- in a text. I do not want to convert them all into paragraph breaks. So if there is a double set,I would like to replace them by a single, across linebreaks. Here is what I have, but it doesn't do anything like I was hoping for..
$uittext = preg_replace('/(\<(\/?)p\>\s*){4,}/msi', '</p><p>', $uittext);
Can somebody lend me a hand here?
Thanks!
J.