I have following text


and I want to find the last one by using a search for the text printer which is not preceded by an underscore character _.

I know that zero matches are !: http://vimdoc.sourceforge.net/htmldoc/pattern.html#/zero-width

so I tried:


None of them works. What is the correct pattern for this search?

1 Answer 1


You're using the wrong zero width multi item. \@! is negative look-ahead. You could use it to e.g. find any printer that is not followed by an underscore:


The multi item you want to use is negative look-behind \_@<!:


See :help \_@<!

An alternative technique would be to use:


Find any character (including an end-of-line) that is not an underscore, followed by printer, and place the cursor one character on from the beginning of the match.

  • And I believe one could use /\_[^_]\zsprinter as an alternative to the /s+1 form.
    – B Layer
    Feb 7, 2018 at 5:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.