Thanks for the feedback.
Here was my problem; I misunderstood how the "+" worked. It only
applies to the last "\n", not both "n\n".
Hans Juergen Von Lengerke wrote:
From: Al <[EMAIL PROTECTED]>
$text= preg_replace("/\n\n+/", "\n\n", $text);
// remove excess This doesn't seem to do anythi
> From: Al <[EMAIL PROTECTED]>
>
> $text= preg_replace("/\n\n+/", "\n\n", $text);
> // remove excess This doesn't seem to do anything.
Strange, your code works for me:
[EMAIL PROTECTED]:~ > cat foo.php
[EMAIL PROTECTED]:~ > php ./foo.php
before:
===
foo
bar
===
after:
===
foo
bar
===
Didn't work. I'm beginning to think the problem is more involved. I am
going to break out just the essentials of the code that is involved and
debug just it.
Thanks
Matt Matijevich wrote:
Next, I want to remove excessive CR/LF, [i.e. more than 2]
$text= preg_replace("/\n\n+/", "\n\n",
Next, I want to remove excessive CR/LF, [i.e. more than 2]
$text= preg_replace("/\n\n+/", "\n\n", $text);
// remove excess This doesn't seem to do anything.
not 100% sure this is right but give it a try
$text = preg_replace("/\n\n+|\n\r[\n\r]+|\r\r+/", "\n\n", $tex
I'm trying to clean up newline code received from a browser textarea.
First, I'm normalizing the newline codes to Unix with:
$text= preg_replace("/(\r\n|\r)/", "\n", $text);
//this seems to work OK
Next, I want to remove excessive CR/LF, [i.e. more than 2]
$text= p
5 matches
Mail list logo