Bug #16512 Updated: PREG_SPLIT_DELIM_CAPTURE does not work
| From: | mfischer@php.net | Date: | Tue, 09 Apr 2002 13:10:23 +0000 |
| Subject: | Bug #16512 Updated: PREG_SPLIT_DELIM_CAPTURE does not work | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-4425@lists.php.net to get a copy of this message | ||
ID: 16512
Updated by: mfischer@php.net
Reported By: bogien@conecto.pl
-Status: Open
+Status: Closed
Bug Type: PCRE related
Operating System: Win32, Linux
PHP Version: 4.1.2
New Comment:
Read the manual:
PREG_SPLIT_DELIM_CAPTURE
If this flag is set, parenthesized expression in the delimiter pattern
will be captured and returned as well. This flag was added for 4.0.5.
So your pattern should look like:
/(a)/
and presto, it works.
Previous Comments:
------------------------------------------------------------------------
[2002-04-09 08:59:34] bogien@conecto.pl
PREG_SPLIT_DELIM_CAPTURE does not work - preg_split() simply omits the
delimiters disregarding the flag.
The following line:
print_r(preg_split('/a/', 'mama', -1, PREG_SPLIT_DELIM_CAPTURE));
...returns:
Array
(
[0] => m
[1] => m
[2] =>
)
...just like without the last argument - while it should return:
Array
(
[0] => m
[1] => a
[2] => m
[3] => a
[4] =>
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=16512&edit=1