Another preg question
| From: | Al | Date: | Fri, 13 Feb 2004 19:24:49 +0000 |
| Subject: | Another preg question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-177631@lists.php.net to get a copy of this message | ||
I'm trying to clean up newline code received from a browser textarea.
First, I'm normalizing the newline codes to Unix with:
$text= preg_replace("/(\r\n|\r)/", "\n", $text); //this seems to work OK
Next, I want to remove excessive CR/LF, [i.e. more than 2]
$text= preg_replace("/\n\n+/", "\n\n", $text); // remove excess This doesn't seem to do anything.
Thanks.....