in reply to How can I match all the integers in a string?
Which prints out:my $numbers="1 1.0 3.547 92.34 343.2234"; while($numbers =~ /(^|[^.\d])(\d+)/g) { print "$2 is an integer\n"; }
For the data you give, /(^| )(\d+)/g also works fine.1 is an integer 1 is an integer 3 is an integer 92 is an integer 343 is an integer
|
|---|