That's quite handy, and thanks for posting it, but sadly it does not explain why the marked branch sets the value of $1 to 'g' even though it "failed..." to match:
Matching REx "(?:(.)b|.)+" against "ebfg" 0 <> <ebfg> | 1:CURLYX[0] {1,32767}(15) 0 <> <ebfg> | 14: WHILEM[1/1](0) whilem: matched 0 out of 1..32767 0 <> <ebfg> | 3: BRANCH(11) 0 <> <ebfg> | 4: OPEN1(6) 0 <> <ebfg> | 6: REG_ANY(7) 1 <e> <bfg> | 7: CLOSE1(9) 1 <e> <bfg> | 9: EXACTF <b>(14) 2 <eb> <fg> | 14: WHILEM[1/1](0) whilem: matched 1 out of 1..32 +767 2 <eb> <fg> | 3: BRANCH(11) 2 <eb> <fg> | 4: OPEN1(6) 2 <eb> <fg> | 6: REG_ANY(7) 3 <ebf> <g> | 7: CLOSE1(9) 3 <ebf> <g> | 9: EXACTF <b>(14) failed... 2 <eb> <fg> | 11: BRANCH(13) 2 <eb> <fg> | 12: REG_ANY(14) 3 <ebf> <g> | 14: WHILEM[1/1](0) whilem: matched 2 out of 1 +..32767

3 <ebf> <g> | 3: BRANCH(11) 3 <ebf> <g> | 4: OPEN1(6) 3 <ebf> <g> | 6: REG_ANY(7) 4 <ebfg> <> | 7: CLOSE1(9) 4 <ebfg> <> | 9: EXACTF <b>(14) failed... 3 <ebf> <g> | 11: BRANCH(13)

3 <ebf> <g> | 12: REG_ANY(14) 4 <ebfg> <> | 14: WHILEM[1/1](0) whilem: matched 3 out +of 1..32767 4 <ebfg> <> | 3: BRANCH(11) 4 <ebfg> <> | 4: OPEN1(6) 4 <ebfg> <> | 6: REG_ANY(7) failed... 4 <ebfg> <> | 11: BRANCH(13) 4 <ebfg> <> | 12: REG_ANY(14) failed... BRANCH failed... whilem: failed, trying + continuat ion... 4 <ebfg> <> | 15: NOTHING(16) 4 <ebfg> <> | 16: END(0) Match successful! Test: 1='g', 2='' Freeing REx: "(?:(.)b|.)+"

In reply to Re^2: Leaking Regex Captures by SuicideJunkie
in thread Leaking Regex Captures by SuicideJunkie

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.