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.
Comment on
Re: Numbers only in a string
Download
Code
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;
[download]
[reply]
[d/l]
In Section
Seekers of Perl Wisdom