|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-05-26 11:54 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 02 13:00:01 2025 UTC |
Description: ------------ I can't tell if this is universal, but with this particular regex it certainly is a bug. I think it is to do with using parentheses directly next to each other. Reproduce code: --------------- <? $str = 'arr[sub][sub_sub]'; die(preg_replace('/([^\[\]]*)(.*)/','[\1]\2',$str)); ?> just for the record, this works as expected if i use the pattern: preg_replace('/([^\[\]]*)\[(.*)\]/','[\1][\2]',$el); so it appears that the problem is when parenthesised (is that correct?) expression appear next to each other. Expected result: ---------------- [arr][sub][sub_sub] Actual result: -------------- [arr][sub][sub_sub][]