Re: [PHP] regex for multiple line breakes

2009-10-14 Thread Merlin Morgenstern
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

Re: [PHP] regex for multiple line breakes

2009-10-14 Thread Fernando Castillo Aparicio
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

Re: [PHP] regex for multiple line breakes

2009-10-14 Thread Ashley Sheridan
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

Re: [PHP] regex for multiple line breakes

2009-10-14 Thread Merlin Morgenstern
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

Re: [PHP] regex for multiple line breakes

2009-10-14 Thread Fernando Castillo Aparicio
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