Ashley Sheridan schrieb:
On Wed, 2009-10-14 at 12:42 +0200, Merlin Morgenstern wrote:
That sounds very logical but does not work unfortunatelly.
The result is the same. It removes all linebreakes but one.
I would like to pass this one:
-
first line
second
third
-
But not th
y Sheridan
Para: Merlin Morgenstern
CC: php-general@lists.php.net
Enviado: miƩ,14 octubre, 2009 12:44
Asunto: Re: [PHP] regex for multiple line breakes
On Wed, 2009-10-14 at 12:42 +0200, Merlin Morgenstern wrote:
> That sounds very logical but does not work unfortunatelly.
> The result
On Wed, 2009-10-14 at 12:42 +0200, Merlin Morgenstern wrote:
> That sounds very logical but does not work unfortunatelly.
> The result is the same. It removes all linebreakes but one.
> I would like to pass this one:
>
> -
> first line
>
> second
> third
> -
>
> But not this one
That sounds very logical but does not work unfortunatelly.
The result is the same. It removes all linebreakes but one.
I would like to pass this one:
-
first line
second
third
-
But not this one:
-
third
forth
Fernando Castillo Aparicio schrieb:
You are
You are replacing 1 or more matchs of a new line. To match 2 or more you can
use "{2,}". It's a range, first number means min matches, second max matches.
Omitting last number means no max limit.
$data[txt] = preg_replace('`[\r\n]{2,}`',"\n",$data[txt]);
De: M
5 matches
Mail list logo