#50463 [Opn->Bgs]: PREG_SPLIT eating character
| From: | felipe@php.net | Date: | Sat, 12 Dec 2009 22:31:28 +0000 |
| Subject: | #50463 [Opn->Bgs]: PREG_SPLIT eating character | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-145677@lists.php.net to get a copy of this message | ||
ID: 50463
Updated by: felipe@php.net
Reported By: bellingan at email dot it
-Status: Open
+Status: Bogus
Bug Type: PCRE related
Operating System: Suse Linux 11.2
PHP Version: 5.3.1
New Comment:
The third param. is for the 'limit', not for flags.
See the examples in the documentation.
Previous Comments:
------------------------------------------------------------------------
[2009-12-12 22:22:19] bellingan at email dot it
Sorry it doesen't return at all the matched text...
------------------------------------------------------------------------
[2009-12-12 22:21:25] bellingan at email dot it
Description:
------------
PREG_SPLIT whit the PREG_SPLIT_DELIM_CAPTURE flag, return the matched
string dropping the first charcater.
Like in http://bugs.php.net/bug.php?id=15413&edit=2
Reproduce code:
---------------
$via="123Gatano_Rizzi";
$res=preg_split("/[a-z]../",$via,PREG_SPLIT_DELIM_CAPTURE);
var_dump($res);
Expected result:
----------------
array(2) {
[0]=>
string(4) "123G"
[1]=>
string(3) "ata"
[2]=>
string(8) "no_Rizzi"
}
Actual result:
--------------
array(2) {
[0]=>
string(4) "123G"
[1]=>
string(8) "no_Rizzi"
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=50463&edit=1