|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-12-12 22:21 UTC] 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" } PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 09:00:01 2025 UTC |
$res=preg_split("/[a-z]../",$via,-1,PREG_SPLIT_DELIM_CAPTURE); Yes... Now is even more oddy... Giving array(4) { [0]=> string(4) "123G" [1]=> string(0) "" [2]=> string(1) "R" [3]=> string(1) "i" } Now I'm using the preg_match("/[a-z]..+/",$via,$res,PREG_OFFSET_CAPTURE); dump($m); giving a Array ( [0] => Array ( [0] => ata [1] => 4 ) )