http://www.perlmonks.org?node_id=1017044


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:

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
The op's regexes don't make much sense.