Assert that something does NOT follow
(?!...) is the inverse: "at this position, the pattern inside does NOT match." Same zero-width behavior — no characters consumed. The match succeeds only if the lookahead pattern would FAIL.
Common patterns
Match a word UNLESS it's followed by a specific suffix. cat(?!s) matches 'cat' but not 'cats' — the negative lookahead asserts 's' does not come next.
Find tokens that aren't followed by a stop word. Useful for parsing where you want "any word EXCEPT when followed by reserved words."
Avoid false positives in URL detection. http(?!s://) matches 'http' but not 'https://' — useful when you want to upgrade plain HTTP references but skip already-secure ones.
The mental flip
Most beginners struggle with negative lookahead because it requires inverting the question. Instead of "what should match?" you ask "what should the next thing NOT be?" Practice helps; the cleanest patterns often use a positive description in the main match plus a negative lookahead to exclude one specific case.