PDA

View Full Version : RegEx Replace - Numbers Only


Ultragames
06-13-2007, 08:29 PM
Hello,

I need to take a string, and replace everything in the string besides numbers, and a '.' with nothing. I really suck at regex, and I was hoping for some quick help on the matter.

Thank you!

mr e
06-13-2007, 09:10 PM
Something like this should do it

$string = preg_replace('/[^0-9\.]/', '', $string);