http://www.perlmonks.org?node_id=1002473


in reply to offset of named capture buffer

See Tie::Hash::NamedCapture, http://perl5.git.perl.org/perl.git/blob/HEAD:/ext/Tie-Hash-NamedCapture/NamedCapture.xs, perlreapi, something about named_buff, http://perl5.git.perl.org/perl.git/blob?f=regcomp.c#l6468

It is possible, but not exactly easy

Replies are listed 'Best First'.
Re^2: offset of named capture buffer
by Anonymous Monk on Nov 06, 2012 at 13:48 UTC
    esp see http://perl5.git.perl.org/perl.git/blob?f=regcomp.c#l6532
    6524 if (rx && RXp_PAREN_NAMES(rx)) { 6525 HE *he_str = hv_fetch_ent( RXp_PAREN_NAMES(rx), namesv, 0 +, 0 ); 6526 if (he_str) { 6527 IV i; 6528 SV* sv_dat=HeVAL(he_str); 6529 I32 *nums=(I32*)SvPVX(sv_dat); 6530 for ( i=0; i<SvIVX(sv_dat); i++ ) { 6531 if ((I32)(rx->nparens) >= nums[i] 6532 && rx->offs[nums[i]].start != -1 6533 && rx->offs[nums[i]].end != -1) 6534 { 6535 ret = newSVpvs(""); 6536 CALLREG_NUMBUF_FETCH(r,nums[i],ret); 6537 if (!retarray) 6538 return ret;