in reply to Re: Regex letter order matching
in thread Regex letter order matching

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"