note 20821 added to function.preg-replace

From: Date: Wed, 17 Apr 2002 11:29:46 +0000
Subject: note 20821 added to function.preg-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-29469@lists.php.net to get a copy of this message
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. -- http://www.php.net/manual/en/function.preg-replace.php http://master.php.net/manage/user-notes.php?action=edit+20821 http://master.php.net/manage/user-notes.php?action=delete+20821 http://master.php.net/manage/user-notes.php?action=reject+20821

« previous php.notes (#29469) next »