I\'m a little stuck. How do I remove multiple newlines which are in a row with one newline. There could be anything up to 20 newlines next to each other. For example
Try this one:
$str = "Hello\n\n\n\n\nWorld\n\n\nHow\nAre\n\nYou?"; $str = preg_replace("/\n+/", "\n", $str); print($str);