in reply to Matching n characters with m//g
I'm not sure just where you're going with this, but it's possible to bite off more than 32,766 repetitions in one chunk, you just have to grind on it a bit:
You can test this match by making the $s stringc:\@Work\Perl\monks>perl -wMstrict -le "use constant K => 234_565; ;; my $s = 'xxx' . 'a' x K . 'yyy'; print substr $s, 0, 10; print substr $s, -10; print length $s; ;; use constant MAX => 32_760; ;; use integer; my $n = K / MAX; print $n; my $m = K % MAX; print $m; ;; my ($t) = $s =~ m{ xxx ((?: .{${ \MAX }}){$n} .{$m}) yyy }xms; print substr $t, 0, 10; print substr $t, -10; print length $t; " xxxaaaaaaa aaaaaaayyy 234571 7 5245 aaaaaaaaaa aaaaaaaaaa 234565
You can use the m//gc modifier pairing (the /c modifier is the new one here) to parse through your text to locate and extract the large number that is the count of the block of characters following. (Update: Please see Using regular expressions in Perl in perlretut for further explanation of the /g and /c modifiers.) If you can get to the point in your string at which you can extract the large number of characters you need next, you can figure the quantifier counts necessary to do a "compound counted quantifier".
That said, it might be better to go the route of an honest-to-goodness parser instead.
Give a man a fish: <%-{-{-{-<
|
|---|