(Change <tt> to <code>, perhaps also minor tweak.) |
(Redirect to VimTipp802) |
||
Line 1: | Line 1: | ||
+ | #REDIRECT [[Search_for_lines_not_containing_pattern_and_other_helpful_searches]] |
||
{{duplicate|802|1180}} |
{{duplicate|802|1180}} |
||
{{TipImported |
{{TipImported |
Latest revision as of 15:37, 1 July 2013
Duplicate tip
This tip is very similar to the following:
These tips need to be merged – see the merge guidelines.
Tip 220 Printable Monobook Previous Next
created 2002 · complexity intermediate · author Michael Geddes · version 6.0
This is a regular expression that matches all words except 'foo'
\v<(foo>)@!\k+>
\v
Very magic<
Start-of-word(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>
Match end-of-word.
The non-magic version is:
\<\(foo\>\)\@!\k\+\>
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):
\(foo\)\@<!bar