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?


<?php

$text = 'waf4u8r94$@%$G^#U`][\/.msg2g21vdbb 5g2g25g9 2  02025';

echo preg_replace('/[^0-9]/', '', $text);

?>

Thanks,

Matt Babineau
Criticalcode
w: http://www.criticalcode.com
p: 858.733.0160
e: matt@xxxxxxxxxxxxxxxx




--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY | http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


--
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