#39947 [Opn->Bgs]: preg_replace failed to replace contiguous char

From: Date: Mon, 25 Dec 2006 18:46:27 +0000
Subject: #39947 [Opn->Bgs]: preg_replace failed to replace contiguous char
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-106871@lists.php.net to get a copy of this message
ID: 39947 Updated by: tony2001@php.net Reported By: dlanoire at neuf dot fr -Status: Open +Status: Bogus Bug Type: PCRE related Operating System: Windows XP SP2 PHP Version: 5.2.0 New Comment: I get the very same result using Perl script, which means it's a PCRE library bug/feature and it should be reported to PCRE developers. Previous Comments: ------------------------------------------------------------------------ [2006-12-25 18:11:54] dlanoire at neuf dot fr Description: ------------ When I try replace the dot by "_d_", preg_replace fails to replace all dots separated by only 1 character. Only One substitution by 2 is working. Reproduce code: --------------- $texte = preg_replace("/(\w)\.(\w)/", "$1_d_$2", "a.b.c.d.e.f"); Expected result: ---------------- The result is a_d_b.c_d_d.e_d_f Actual result: -------------- The result should be a_d_b_d_c_d_d_d_e_d_f On the other side, the replacement below works and gives the good result : aa_d_bb_d_cc_d_dd_d_ee_d_ff $texte = preg_replace("/(\w)\.(\w)/", "$1_d_$2", "aa.bb.cc.dd.ee.ff"); ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=39947&edit=1

« previous php.bugs (#106871) next »