Re: Sigh....regex - need to search/replace string for anything but numbers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Matt Babineau wrote:
Ahh so the regex gods are pissed at me. This is simple (I think), but I need
to figure out how to strip out everything in a string that is not a number.
Any takers?

I appear to have written that last snippet without really even looking at it. This one works.


<?php
$string = "asd98.a98asd/7987asd";
$numbers = preg_replace( "/[^0-9]/", "", $string );
?>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux