in reply to Numbers only in a string

s/[\D]+//g;

\D is the opposite of \d so it will replace anything that's not a digit.

Replies are listed 'Best First'.
Re^2: Numbers only in a string
by davidrw (Prior) on Sep 08, 2005 at 16:23 UTC
    don't need to use a character class here -- just:
    s/\D+//g;