in reply to Matching numeric value between two digits
Also rather than the clumsy /\d{1}-\d{2}/ you might wish to use /[0-9]+/
Of course, those regexes don't match the same things:
The op's regexes don't make much sense.use strict; use warnings; use 5.012; my $str = "8-91"; if ($str =~ /(\d{1}-\d{2})/) { say $1; } if ($str =~ /([0-9]+)/) { say $1; } --output:-- 8-91 8
|
---|
In Section
Seekers of Perl Wisdom