All, I am puzzled by a slightly more complicated version: how to match a '%' character following the 2nd occurrence of "home"?
--Matt On Fri, Dec 01, 2006 at 09:09:17AM -0500, Charles E Campbell Jr wrote: > 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 > > > > > > > To generalize to the n-th occurrence: (put the qty of skipped matches in N) > > /^.\{-}\%(home.\{-1,}\)\{N}\zshome > > So, for the 2nd home: let N=1. > > Regards, > Chip Campbell >