Skip to content
Prev 245031 / 398503 Next

Numbers in a string

On Wed, Dec 15, 2010 at 01:29:16PM -0500, David Winsemius wrote:
One of the suggestions in this thread was to use an external program.
A possible solution without negation in Perl is

  @a = ("AB15E9SDF654VKBN?dvb.65" =~ m/[0-9]/g);
  print @a, "\n";
  15965465

or

  @a = ("AB15E9SDF654VKBN?dvb.65" =~ m/[.0-9]+/g);
  print join(" ", @a), "\n";
  15 9 654 .65

Do you mean something in this direction?

Petr Savicky.