I tried to look into Tie::Hash::NamedCapture, the "Pragmatic Module" used to implement %+ and %- but stopped at the XS barrier

I looked at this as well, specifically at FIRSTKEY and NEXTKEY in NamedCapture.xs, because I was hoping that maybe the iteration order would be the same as the order of the capture groups, but sadly that doesn't seem to be the case. Anyway, its implementation appears to use named_buff_iter in regcomp.c, and the central function here appears to be reg_named_buff_nextkey. But that's as far as I've gotten in my research, my understanding of the internals isn't good enough to see if there's an "easy" way to access the capture group name to number mapping.


In reply to Re: [RE] match positions of named captures? by haukex
in thread [RE] match positions of named captures? by LanX

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.