in reply to Re: Regex Subexpressions
in thread Regex Subexpressions
Here's another "solution", which may not be at all correct (it matches an input string of "aaa", for example), but does it shed any more light on what the solution should be?:#!/usr/bin/perl -w use strict; use warnings; my $test = 'abc'; my @matches; $test =~ /(a(bc?)?)(??{unshift @matches, $^N})(?!)/; print "@matches\n";
#!/usr/bin/perl -w use strict; use warnings; my $test = "abc"; my $count = 1; while ($test =~ m/([abc]{$count})/) { my $match = $1; ++$count; printf "%s\n", $match; }
|
|---|