Re: Reg exp to remove line feeds before lines starting with white space
| From: | Analysis & Solutions | Date: | Thu, 25 Jul 2002 19:51:30 +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-109594@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.
In ereg_replace() you can use [[:space:]] as the pattern and replace it
with ' '. That will grab all whitespace characters and replace them with
a one space.
To do that with preg_replace() use \s.
--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