created 2002 · complexity intermediate · author Michael Geddes · version 6.0
This is a regular expression that matches all words except 'foo'
(Foo>)The atom 'Foo' followed by end-of-word
@!Match (with zero length) when the previous atom doesn't match.
\k+Match one or more Keywords
The non-magic version is:
The use of
\@! can be very tricky. According to the Vim help files, it is often easier to use
\@<! instead. For example, to find all 'bar' strings unless they are part of 'foobar', use the following (non-magic):