my $test = "Auto And Company 57 DI 13 FA 13 FAI 4 Login 23 Not Found 4 "; if($test=~/(.*?)(\s\d+\s\w+){5}\s(\w+)\s(\d+)/gi) { print $1; }