use strict;
use warnings;
my $text = "test1 zzzzzzzzzzzzzzz test2 test3 test4 test5 zzzzzzzzzzzzzzz test6 test7 zzzzzzzzzzzzzzz test8 test9 test10";
my @matches = $text =~ /([a-zA-Z0-9]+\s+[z]{15}\s+[a-z0-9]+)/g;
print "string: $_!\n" for @matches;
####
string: test1 zzzzzzzzzzzzzzz test2!
string: test5 zzzzzzzzzzzzzzz test6!
string: test7 zzzzzzzzzzzzzzz test8!
####
...
my @cap = $text =~ /([a-zA-Z0-9]+)\s+[z]{15}\s+([a-z0-9]+)/g;
while (@cap) {
print "string: $cap[0] ... $cap[1]\n";
splice @cap, 0, 2;
}
####
string: test1 ... test2
string: test5 ... test6
string: test7 ... test8
####
print "string: $1 ... $2\n";