-春和景丽的回答
i use nicEdit to write RTF data in my CMS. The problem is that it generates strings like this:
hello first linethis is a second line<
This will work even if the two s are on different lines (i.e. there is a newline or any whitespace between them):
function replace_br($data) { $data = preg_replace('#(?:\s*?){2,}#', '', $data); return "$data"; }
', $data); return "
$data