my @source = $text =~ /(regex1)((?:regex2)+)(regex3)/g; my @repeated = $source[1] =~ /.../g; # or split or whatever