hi all
you should try this:
$string = preg_replace("/([\\n\\r]){2,}/", "\\1", $string);
you should use double backslash... a single backslash is an escape character and could be confusing for the regex-machine,
although both double and single backslash work for me.
\1 returns the value found in the () - brackets... which means that the expression should replace "\r\n\r\n" with "\r\n" , "\n\n" with "\n", "\r\r" with "\r" and so on, to remain portable 🙂
generally you should prefer preg_replace to ereg_replace, because it is mostly faster than ereg... 🙂
cya
axo