in reply to Re: Regex negative word
in thread Regex negative word
your codes fails, because there is no such thing as complex grouping inside character classes (apart form ranges denoted by -). So especially your (?:cat) in there is not a single entity saying "c followed by a followed by t", but refers to the 7 characters it consists of.
Grandfather saw this, but obscured the point in his reply somewhat by reordering that 7 chars. But you can use your code with his __DATA__ and still see that lines beginning with "a" or any "c" (not only that reading "cat") will yield no match!
The way to solve the problem of the OP is to use look-ahead-assertions, as demonstrated by Grandfather in both his replies.
|
|---|