my $input = 'GigabitEthernet1/0/49xxx7/0/48'; #### if ($input =~ m{ ^ (gi [^/]*) ([1-8]) / 0 / ([1-9] | [1-3][0-9] | 4[0-8]) $ }ix) {