Hi,

Wolfgang Schmidt wrote:
> 
> I'm trying to do a regexp replacement. My original line is
> 
> ignore MATCH1 ignore_again MATCH2
> 
> I want to match MATCH1 and MATCH2, so here's my trial:
> 
> s/^ignore \(.*\{-}\) .*\{-} \(.*\)/matched:\1,\2/gc
> 
> I tried to use \{-} to make the ".*" match non-greedy, but I get E62 and 
> E476.

in contrast to Perl where you have to append ? to * to make the match
non-greedy, in Vim you must replace * with \{-}. The correct regexp
would have been

  s/^ignore \(.\{-}\) .\{-} \(.*\)/matched:\1,\2/gc

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us.     (Calvin)

Reply via email to