tags:

views:

62

answers:

1

If I have a string $random, and I want to throw out everything except commas and numbers, how could I do this in PHP PCRE?

I know \d will match numbers, but I don't get the rest of PCRE.

+3  A: 

Try something like

preg_replace("/[^\d,]/", "", $random);
Chris Gutierrez