At 02:43 PM 12/5/01 -0500, Jack Dempsey wrote:
>$t = preg_replace('/\s+/',' ',$text);

One more thing:
How do I replace with newline instead of a space?  I read through the manuals but 
couldn't grasp how to do this.  \n didn't cut it.

And, more advanced - 
The above replaces any groups of 2 or more blanks (newlines, spaces, tabs) with a 
single blank.
Is there an easy way to replace them with EITHER a space or a newline, depending on 
whether any newlines were present in the input?
I.e. bbbbbbbbbbbbbb would be replaced with b, but bbbbbnbbbbbnbbbb would be replaced 
with n.

Right now the issue is that I'm sometimes getting results that have no line breaks for 
a really long time, and I know there are reasons to try to avoid individual lines of 
HTML longer than 200 characters.


- Ken

PHP General Mailing List (
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