"it is surprising how a glass of Italian Chardonnay can do good to the brain cells"

But it is far from surprising that providing a clear specification of what you seek will enhance the liklihood that the Monks will provide useful advice.

I mention this because your original post. The first bit of code, [/^(BAR|BAZ)$/, requires that /BA[RZ]/ NOT be the last element of your string, while the second, the negative lookahead, (?!(BAR|BAZ)).*$/, allows anything NOT /BA[RZ]/ followed by (your dot_deathstar, .* any number of any characters INCLUDING /BA[RZ]/.

Judging by other replies, I wasn't the only one confounded thereby. yet very shortly after your clarifying example (in this node's parent) you got a reasonably general answer from Anonymonk (and re that answer, I'm not sure I buy the advice to "avoid as the plague the use of capturing groups in the decomposed regexes..." but the thought process outlined in that node deserves a ++ ((and got same from me)).


In reply to Re^4: Zero-width look-ahead regexp question by ww
in thread Zero-width look-ahead regexp question by rovf

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.