Bill McCarthy wrote:
On Thu 30-Nov-06 11:49pm -0600, Peter Hodge wrote:
--- Bill McCarthy wrote:
On Thu 30-Nov-06 10:24pm -0600, Peter Hodge wrote:
--- Bill McCarthy 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
Yes, I know it works. You stated that it was "safer to
anchor the pattern to the start of the line." I was asking
for a example of a failure of '/home.\{-}\zshome' that would
require such an anchor.
He gave it. In the above case, you highlight not only the 2nd occurrence but
also the 4th, 6th, etc.
Best regards,
Tony.