diff options
Diffstat (limited to 'runtime/doc/pattern.txt')
-rw-r--r-- | runtime/doc/pattern.txt | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt index 0fd31d658f..84cd7360a0 100644 --- a/runtime/doc/pattern.txt +++ b/runtime/doc/pattern.txt @@ -1,4 +1,4 @@ -*pattern.txt* For Vim version 7.3. Last change: 2011 Feb 25 +*pattern.txt* For Vim version 7.3. Last change: 2011 Apr 28 VIM REFERENCE MANUAL by Bram Moolenaar @@ -651,6 +651,13 @@ overview. "foobar" you could use "\(foo\)\@!...bar", but that doesn't match a bar at the start of a line. Use "\(foo\)\@<!bar". + Useful example: to find "foo" in a line that does not contain "bar": > + /^\%(.*bar\)\@!.*\zsfoo +< This pattern first checks that there is not a single position in the + line where "bar" matches. If ".*bar" matches somewhere the \@! will + reject the pattern. When there is no match any "foo" will be found. + The "\zs" is to have the match start just before "foo". + */\@<=* \@<= Matches with zero width if the preceding atom matches just before what follows. |/zero-width| {not in Vi} |