vim regex with meta-characters

The non-greedy character ? doesn't work in Vim; you should use:

cv_.\{-}\s

...instead of:

cv_.*?\s

Here's a quick reference for matching:

     * (0 or more) greedy matching
    \+ (1 or more) greedy matching
  \{-} (0 or more) non-greedy matching
\{-n,} (at least n) non-greedy matching

vim's regex syntax is a little different -- what you're looking for is

cv_.\{-}\s

(the \{-} being the vim equivalent of perl's *?, i.e., non-greedy 0-or-more). See here for a good tutorial on vim's regular expressions.

Tags:

Vim

Regex