preg_grep
| From: | Mark Harwood | Date: | Tue, 22 Oct 2002 07:36:18 +0000 |
| Subject: | preg_grep | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-120867@lists.php.net to get a copy of this message | ||
Hi All,
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.
Thanks.