Since Perl is stopping at the first successful match, you'll only get the first number. Since the empty string is a successful match for \d*, that's what you're getting :)my $sentence = "I fear that i will be extinct after 1000 or 2000 years +"; if($sentence =~ /(\d+)/) { print "That said '$1' years.\n"; }
In reply to Re^2: question about the star(*) quantifier
by wojtyk
in thread question about the star(*) quantifier
by snowsky
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |