note 20821 deleted from function.preg-replace by sniper
| From: | sniper@php.net | Date: | Sun, 07 Sep 2003 22:08:19 +0000 |
| Subject: | note 20821 deleted from function.preg-replace by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-55712@lists.php.net to get a copy of this message | ||
Note Submitter: fuepi_at_fuepi.de
----
Someone noted that preg_replace wouldn't support newlines. That is not correct. The problem is
that a newline in php isn't the same as in perl. You should use "\r\n" in php where
you would use "\n" in perl.
php : preg_replace("'\r\n\r\n"'is,"\r\n",$text)
perl: $text =~ s/\n\n/\n/gis
See http://www.php.net/manual/en/html/language.types.string.html
for further info.