I don't like the idea of leftmost-outermost. That would severely slow the regex engine up if it has to decide whether it should store this capture or not each time it encounters one.

Presumably this would be resolved at the compile time of the regex, and IMO would be quite simple to resolve.

Assigning them directly to where I want them seems simpler and more reliable to me.

Hmm. I see your point (sort of) but I wonder how your angle would work with using qr// multiple times. For (not such a great) instance:

my $sep=qr/(?<sep>[-\/\\])/; my $date=qr/(?<year>\d{4})$sep(?<month>\d{2})$sep(?<day>\d{2})/

Hence the reason I thought of a hash of arrays. Also, the embedded $var name would _totally_ violate the quoting rules of perl, perhaps the idea that the names map to lexicals in scope (if defined) otherwise to ones it defines itself? (Which incidentally turns regex LHS's into a variant of a my(). I really dont see how this would work without seriously changing things. Mapping to a hash wouldn't have anywhere near the number of bizarre sideffects.


---
demerphq

    First they ignore you, then they laugh at you, then they fight you, then you win.
    -- Gandhi



In reply to Re: Re:+: my versus our in nested regex by demerphq
in thread my versus our in nested regex by Len

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.