1

I've found the way to do this is using negative - lookahead and / or posistive lookbehind but I don't seem to find how to type it.

I'm trying to highlight all the lines where the word length is not present

I'm writing ( without success ) /length\@!/

What would be the correct way?

OscarRyz
  • 196,001
  • 113
  • 385
  • 569
  • possible duplicate of [Hide all (not)matching lines in VIM](http://stackoverflow.com/questions/862966/hide-all-notmatching-lines-in-vim) – jamesmortensen Mar 12 '12 at 00:16
  • 2
    @jmort253 Not the same, I'm searching and want to highlight the non matching word. The referred answer hides the non matching lines and highlights the matching one. – OscarRyz Mar 12 '12 at 00:19

1 Answers1

2

Try /^\(\(length\)\@!.\)*$/

This is basically ^.*$ where . can't be followed by length.

In perl regex, it'd be ^((?!length).)*$.

(Make sure you have :set hlsearch to actually highlight all the relevant lines).

mathematical.coffee
  • 55,977
  • 11
  • 154
  • 194