that can work if you do TWO match operations

1) match pattern to reject (the one with cb) 2) match pattern to accept (same exact pattern except no "cb" literal

Or look ahead

$ perl -Mre=debug -le " $_ = q{this TON that}; m{this \s+ (?!NOT)\w+ \ +s+that}msgx; " Compiling REx "this \s+ (?!NOT)\w+ \s+that" Final program: 1: EXACT <this> (3) 3: PLUS (5) 4: SPACE (0) 5: UNLESSM[0] (11) 7: EXACT <NOT> (9) 9: SUCCEED (0) 10: TAIL (11) 11: PLUS (13) 12: ALNUM (0) 13: PLUS (15) 14: SPACE (0) 15: EXACT <that> (17) 17: END (0) anchored "this" at 0 floating "that" at 7..2147483647 (checking floati +ng) minlen 11 Guessing start of match in sv for REx "this \s+ (?!NOT)\w+ \s+that" ag +ainst "this TON that" Found floating substr "that" at offset 9... Found anchored substr "this" at offset 0... Guessed: match at offset 0 Matching REx "this \s+ (?!NOT)\w+ \s+that" against "this TON that" 0 <> <this TON t> | 1:EXACT <this>(3) 4 <this> < TON that> | 3:PLUS(5) SPACE can match 1 times out of 21474 +83647... 5 <this > <TON that> | 5: UNLESSM[0](11) 5 <this > <TON that> | 7: EXACT <NOT>(9) failed... 5 <this > <TON that> | 11: PLUS(13) ALNUM can match 3 times out of 214 +7483647... 8 <his TON> < that> | 13: PLUS(15) SPACE can match 1 times out of 2 +147483647... 9 <his TON > <that> | 15: EXACT <that>(17) 13 <his TON that> <> | 17: END(0) Match successful! Freeing REx: "this \s+ (?!NOT)\w+ \s+that"

In reply to Re^2: Regex letter order matching by Anonymous Monk
in thread Regex letter order matching by cspctec

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.