Re: Reg exp to remove line feeds before lines starting with white space

From: Date: Thu, 25 Jul 2002 23:39:28 +0000
Subject: Re: Reg exp to remove line feeds before lines starting with white space
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-109624@lists.php.net to get a copy of this message
On Thu, 25 Jul 2002, Nicklas af Ekenstam wrote: > I'm trying to do some parsing of mail headers and since not all > headers follow the pattern: > > X-Header-A: A string > X-Header-B: Another string that is longer > X-Header-C: And this string is very very long compared > > But may very well look like this: > > X-Header-A: A string > X-Header-B: Another string that is > longer > X-Header-C: And this string is very very long > compared I imagine you want something like (untested): $str = preg_replace('/\n[ \t]+/s', ' ', $str); miguel

« previous php.general (#109624) next »