Re: Reg exp to remove line feeds before lines starting with white space
| From: | Analysis & Solutions | Date: | Thu, 25 Jul 2002 23:58:31 +0000 |
| Subject: | Re: Reg exp to remove line feeds before lines starting with white space | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-109627@lists.php.net to get a copy of this message | ||
> On Thu, Jul 25, 2002 at 12:36:27PM +0200, Nicklas af Ekenstam wrote:
> >
> > In order to read the headers into an array of header key/value fields
> > i would like a reg exp to remove all new lines/line feeds before a
> > line starting with one or more white spaces or tabs.
Pardon my prior post. I only saw "how to remove new lines/line feeds" and
not the second part of the sentence "before a line starting with one or
more white spaces or tabs."
preg_replace('/[\r\n]+[ \t]+/', ' ', $header);
--Dan
--
PHP classes that make web design easier
SQL Solution | Layout Solution | Form Solution
sqlsolution.info | layoutsolution.info | formsolution.info
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409