RE: [PHP] Simple String Replace Question

From: Date: Mon, 26 Feb 2001 13:39:01 +0000
Subject: RE: [PHP] Simple String Replace Question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-41679@lists.php.net to get a copy of this message
Would $string_new = ereg_replace("\n[ \t\r\n]*\n", "\n", $string); work for you? Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) maxim@phpbeginner.com www.phpbeginner.com -----Original Message----- From: Jeff Oien [mailto:jeff@webdesigns1.com] Sent: Monday, February 26, 2001 3:37 AM To: PHP Subject: [PHP] Simple String Replace Question I would like to get rid of \n characters unless there are two or more in a row. So for example if there is a long email formatted like we do here with line break I want to remove the line breaks so text can be wrapped by a browser, but also show paragraph breaks where necessary. This is what I have: $string_new = str_replace("\n", "", $string); How can I augment this to not replace: \n \n Thanks. Jeff Oien -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#41679) next »