#39947 [NEW]: preg_replace failed to replace contiguous char

From: Date: Mon, 25 Dec 2006 18:11:54 +0000
Subject: #39947 [NEW]: preg_replace failed to replace contiguous char
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-106870@lists.php.net to get a copy of this message
From: dlanoire at neuf dot fr Operating system: Windows XP SP2 PHP version: 5.2.0 PHP Bug Type: PCRE related Bug description: preg_replace failed to replace contiguous char 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 bug report at http://bugs.php.net/?id=39947&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39947&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39947&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39947&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=39947&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=39947&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=39947&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=39947&r=needscript Try newer version: http://bugs.php.net/fix.php?id=39947&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=39947&r=support Expected behavior: http://bugs.php.net/fix.php?id=39947&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=39947&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=39947&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=39947&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39947&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=39947&r=dst IIS Stability: http://bugs.php.net/fix.php?id=39947&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=39947&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=39947&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=39947&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=39947&r=mysqlcfg

« previous php.bugs (#106870) next »