|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-12-25 18:46 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 08:00:01 2025 UTC |
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");