in reply to Re: Extracting a number from a string
in thread Extracting a number from a string

That would make "05 stringstring" return 05, though, not 5.

Maybe something like:

my ($num) = $string =~ /0*(\d+)/;

That would also correctly set $num to 0 for a string like "string0string", right?


Queue
still making his way through Mastering Regular Expressions

Replies are listed 'Best First'.
Re^3: Extracting a number from a string
by diotalevi (Canon) on Jan 12, 2003 at 17:21 UTC