The !
is not a keyword character (in your case, at least), so a regular expression assertion for a keyword to non-keyword boundary (which \>
is) won't match after it. What does work is this
/\<this\>!/
But here, the \>
is superfluous, as s
clearly is a keyword character, and !
isn't. So, only use the assertions where actually needed (like \<
at the beginning in your example, to avoid matching foothis!
), and all is well.
Alternatively, if for your purposes !
belongs to a word, and you want to match it as such, include it via
:setlocal iskeyword+=!
and use \k
for matching inside the word, e.g. \<\k\{5}\>
to find all 5-letter (key)words.