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)
 [EMAIL PROTECTED]
 www.phpbeginner.com




-----Original Message-----
From: Jeff Oien [mailto:[EMAIL PROTECTED]]
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to