Hi,
Bob Fleming wrote:
> Hi all,
>
> I believe vim carries out greedy pattern matching, i.e. the longest pattern
> found will be used. Is there a way of performing shortest matching ?
>
> As an example, I have the following text:
>
> fe fi fo united kingdom fe fi fo 0911 209 30 30
>
> and I want to delete everything up to the word united so I used :%s/.*fo //
> but this deleted everything up to 0911.
have a look at ":help /\{"
:%s/.\{-\}fo //
Another way to remove everything in front of "united" is
:%s/.*\zeunited//
for the last "united" on the line and
:%s/.\{-}\zeunited//
for the first "united" (see ":help /\ze" for the special meaning of \ze)
Regards,
Jürgen
--
Jürgen Krämer Softwareentwicklung
HABEL GmbH & Co. KG mailto:[EMAIL PROTECTED]
Hinteres Öschle 2 Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-Weilheim Fax: +49 / 74 61 / 93 53 - 99