[pmwiki-devel] preg_replace question

Patrick R. Michaud pmichaud at pobox.com
Fri Nov 10 10:26:06 CST 2006


On Fri, Nov 10, 2006 at 03:55:38PM +0000, Hans wrote:
> Hi,
> how do I extract all digits from a mixed string,
> for instance
> abc 123.456de => 123456
> (anything removed but the digits)

    $x = preg_replace('/\\D+/', '', $x);

(replace all non-digits with '').

Pm



More information about the pmwiki-devel mailing list