Heh... Thanks, but I want to do it the forces of the regular
expression (without external code).
The really funny thing is, all of the broken examples you cite as somehow desirable in the root node execute "external code" (which I take to mean non-regex Perl code), via the experimental features (?{ ... }) and (??{ ... }):
0day's code:
$binary_data =~ /(.)(.){(?{unpack 'H*', $1})}/; # ?
/(.)(?{unpack 'H*', $1})(.){$^R}/; # ???
/(.)((??{'.' x $1}))/;
/(\d)((??{'.*?\n' x $1}))/;
how to assign a value aaaa\n of $3, bbbb\n -> $4 etc ?
Short answer: you can't, unless you're OK with this:
/(\d) ([^\d]+?\n)? ([^\d]+?\n)? ([^\d]+?\n)?
([^\d]+?\n)? ([^\d]+?\n)? ([^\d]+?\n)?
([^\d]+?\n)? ([^\d]+?\n)? ([^\d]+?\n)? /x;
printf "%d: <%s>\n", $_, eval '$'.$_ for 2..$1+1;
But, no doubt you already thought of that. I want to help you, and to do that, I need a complete description of the actual problem you're trying to solve that you need our help with, as well as some real examples of input and expected output.