Well, for one, I wasn't seeking a true/false value from the regular expression; I'm simply using the engine to do some dirty work. The question I have really hasn't been answered even if the code you posted works. I'd like to know why the hash is cleared upon exiting the regex, when it is quite obviously (or so I think) populated upon successful matching of the lookbehind, matching pattern, and then lookahead.

I know that embedded code in a regex is experimental. The code I'm writing is write once, execute once, and then never look at again. I generally don't write code like this, especially not in production, but when I came across what I felt was something strange, I simplified the code down to what I felt to be the simplest case that generated the problem, and then asked about it.


In reply to Re: Re: regex code embedding problem? by perlguy
in thread regex code embedding problem? by perlguy

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.