]*?\>|\n)+$/", $text, $matches); if (count($matches) > 0) { $append = $matches[0]; $text = substr($text, 0, -1 * strlen($append)); $tagNum = substr_count($append, ']*?\>){' . $tagNum . '}/', $text, $matches); if (count($matches) > 0) { $prepend .= $matches[0]; $text = substr($text, strlen($matches[0])); } } $lines = explode("\n\n", $text); return $prepend . "

" . implode("

\n

", $lines) . "

" . $append; } }