if ($_ =~ /\something(.*)somethingelse/i){ if($1 => 1 and $1 <= 75 and /\d{1}-\d{2}/) { ... } }