Bug #52723 [NEW]: Something wrong with preg_replace

From: Date: Sat, 28 Aug 2010 14:22:45 +0000
Subject: Bug #52723 [NEW]: Something wrong with preg_replace
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-153869@lists.php.net to get a copy of this message
From: Operating system: Win Server 2008 PHP version: 5.2.14 Package: Scripting Engine problem Bug Type: Bug Bug description:Something wrong with preg_replace Description: ------------ you see,I just need one 1 in the return value,but,where did the second "1" come from? I use ([a-zA-Z0-9])* to match all numbers and letters, and I just using only one "a" as the input parameter But how can the return value be the "double 1"? Test script: --------------- echo preg_replace("/([a-zA-Z0-9])*/","1","a"); Expected result: ---------------- 11 -- Edit bug report at http://bugs.php.net/bug.php?id=52723&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52723&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52723&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52723&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=52723&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52723&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=52723&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=52723&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=52723&r=needscript Try newer version: http://bugs.php.net/fix.php?id=52723&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=52723&r=support Expected behavior: http://bugs.php.net/fix.php?id=52723&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=52723&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=52723&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=52723&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52723&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=52723&r=dst IIS Stability: http://bugs.php.net/fix.php?id=52723&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=52723&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=52723&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=52723&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=52723&r=mysqlcfg

« previous php.bugs (#153869) next »