Mercurial > vim
diff runtime/doc/pattern.txt @ 2788:0877b8d6370e
Updated runtime files.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Thu, 28 Apr 2011 19:02:44 +0200 |
parents | 6f63330ec225 |
children | fd09a9c8468e |
line wrap: on
line diff
--- 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}