Re: preg_grep
| From: | DL Neil | Date: | Tue, 22 Oct 2002 09:40:57 +0000 |
| Subject: | Re: preg_grep | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-120873@lists.php.net to get a copy of this message | ||
Hi Mark,
> I've written a inifile class and was trying to improve it but got stuck
> trying to read all the sections:
>
> [Section 1]
> name=value
> [Section 2]
> name=value
>
> $Inifile is the inifile read into an array but the following doesn't work:
>
> $Sections = preg_grep("/(?<=^\[)([^\[\]]+)(?=\]$)/i", $IniFile);
>
> It always includes the [ ] brackets. Don't look behinds/aheads work with
> preg_grep? Or am I doing something wrong.
Not a direct answer to your question:
Have you noted the parse_ini_file() filesystem function?
Regards,
=dn