July 14, 2008

VIM not greedy

Regexps  on vim are greedy.. very greedy.

so s/”.*”//  will nomnomnomnom the whole

on a “bar” foo “foobar” day

and end with

on a day

I’ve just learned the \{-} the non greedy *

so s/”.\{-}”// is

on a foo “foobar” day

Nice day when we learn a new vi detail..