--- Bill McCarthy <[EMAIL PROTECTED]> wrote:
> On Thu 30-Nov-06 10:24pm -0600, you wrote:
>
> > --- Bill McCarthy <[EMAIL PROTECTED]> wrote:
>
> >> On Thu 30-Nov-06 9:20pm -0600, Peter Hodge wrote:
> >>
> >> > Try:
> >> >
> >> > /^.\{-}home.\{-}\zshome
> >> >
> >> >
> >> > for your reference:
> >> >
> >> > \{-} makes the '.' match as little as possible
> >> > \zs makes the search match begin at this point in the pattern
> >>
> >> One might think so, but also note:
> >>
> >> :help non-greedy
> >>
> >> In particular, ready the sentence starting with "BUT". All
> >> that is needed is:
> >>
> >> /home.\{-}\zshome
> >>
> >> Earliest is preferred to shortest.
>
> > Yes, but that could also match a 3rd or 4th or 5th occurance of 'home' in
> one
> > line, so it's slightly safer to anchor the pattern to the start of the
> line.
>
> Given the use of the "shortest match first algorithm" I
> don't see how that's possible. Please give an example.
'/home.\{-}\zshome' will match every 2nd home in the following text:
home home home home
home home home home home home home home
home home home home home
This is assuming you are doing a normal search using '/', not using a command
like ':g' or ':s' with the 'g' flag.
regards,
Peter
Send instant messages to your online friends http://au.messenger.yahoo.com