Edit report at http://bugs.php.net/bug.php?id=52723&edit=1
ID: 52723 Comment by: clark21330 at gmail dot com Reported by: clark21330 at gmail dot com Summary: Something wrong with preg_replace Status: Bogus Type: Bug Package: Scripting Engine problem Operating System: Win Server 2008 PHP Version: 5.2.14 Block user comment: N New Comment: I will try it~Thanks rasmus~ Previous Comments: ------------------------------------------------------------------------ [2010-08-28 16:37:52] [email protected] * doesn't mean what you think it does in a regular expression. You want a + there. Like this: echo preg_replace("/([a-zA-Z0-9])+/","1","a"); ------------------------------------------------------------------------ [2010-08-28 16:22:44] clark21330 at gmail dot com 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 this bug report at http://bugs.php.net/bug.php?id=52723&edit=1
