in reply to How to capture quantified repeats?

Sure, you can, but you'd probably need to use an extra variable, or two:

use strict; use warnings; my $ham = "spam\tspam\tspam\t\tyam\tclam"; my @foo; my @jam = ($ham =~ (m/^[^\t]*\t[^\t]*(?:\t([^\t]*)(?{push @foo, $^N})) +{3}\t[^\t]*$/)); print join("\n", '**', @jam, '**', ''); print join("\n", '**', @foo, '**', '');

You may need to do some variation of the local variable dance as shown in perlretut if backtracking is a concern.

Replies are listed 'Best First'.
Re^2: How to capture quantified repeats?
by ikegami (Patriarch) on Sep 23, 2010 at 16:04 UTC
    There are a couple of issues with that code, but the OP made it clear he only want a yes/no answer. I was going to post something of the kind, but it's not nearly as good as BrowserUk's solutions.