Let\'s say this is my text:
this is my text this
is my text this is my text
my text is this
I would like to highlight all text ex
Try this:
:%s/\(^\|\(text\)\@<=\).\{-}\($\|text\)\@=//g
Explanation:
\(^\|\(text\)\@<=\) # means start of line, or some point preceded by “text”
.\{-} # as few characters as possible
\($\|text\)\@= # without globbing characters, checking that we reached either end of line or occurrence of “text”.
Another way to do it:
:help match()
to help you design that):%s/.*/\=repeat('text', matchcount('text', submatch(0)))