From:             
Operating system: Ubuntu 10.10
PHP version:      5.3SVN-2011-03-16 (SVN)
Package:          PCRE related
Bug Type:         Bug
Bug description:preg_grep does not recognize this regex '/[0-9]*$/' to filter 
numbers out

Description:
------------
I am trying to filter numbers from the end of a string in a array.



i have a array full of these strings :



$testArr = array('foto_1','foto_45');



$resArr = preg_grep('/[0-9]*$/',$testArr);



and the $resArr array that gets returned from preg_grep, contains the same

strings, i am looking for a array that contains just the numbers that were


filtered using the regex





Test script:
---------------
<?php



$testArr = array('foto_1','foto_45');



$resArr = preg_grep('/[0-9]*$/',$testArr);



print_r($resArr);



?>

Expected result:
----------------
to see a array full of the numbers what were at the end of the string in
the 

input array



something like this :



Array

(

    [0] => 1

    [1] => 45

)

Actual result:
--------------
Array

(

    [0] => foto_1

    [1] => foto_45

)

-- 
Edit bug report at http://bugs.php.net/bug.php?id=54279&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=54279&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=54279&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=54279&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=54279&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=54279&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=54279&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=54279&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=54279&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=54279&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=54279&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=54279&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=54279&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=54279&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=54279&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=54279&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=54279&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=54279&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=54279&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=54279&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=54279&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=54279&r=mysqlcfg

Reply via email to