René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

Searching in VIM

Concat operator

The concat operator is PATTERN\&PATTERN. It maches the last pattern if all preceding patterns (joined by the concat operator) match as well.
For example /.*foo\&.*bar matches any (beginning of a) line containing foo and bar, irrespective of their order.

Zero-width Assertions

Zero-width positive look ahead assertion

ATOM\@=
The perl equivalent is (?=PATTERN)

Zero-width negative look ahead assertion

ATOM\@!
The perl equivalent is (?!PATTERN)

Zero-width positive look behind assertion

ATOM\@<=
The perl equivalent is (?<=PATTERN)

Zero-width negative look behind assertion

ATOM\@<!
If for example you want to find all lines that don't end with at least three digits in this snippet,
eins 1
zwei 2
hundert 100
tausend 1000
dreiunddreissig 33
vierhundertachzig 480
fuenfhundert 500 f
you can use
\(\d\{3\}\)\@<!$
to do this.
Alternatively, to find all bar that are not preceeded by a foo:
/\(foo.*\)\@<!bar
The perl equivalent is (?<!PATTERN)

Non greedy search

ATOM\{-}

Searching within muliptle lines

\_.

Searching in a range only

Searching for a pattern in the range line 51 through line 99
\%>50l\%<100lPATTERN/