Wednesday, June 2, 2010

RE: Search for several words in each line with vim?

>
> On Wed, June 2, 2010 4:29 pm, rewar wrote:
> > Hi,
> >
> > I have looked around for a way to do this but just cant
> seem to find
> > it. Basically, I have very large documents where I want to often
> > search for a few words in a line, but they wont be all together.
> >
> > For example, I want to be able to find the line below in a
> large text
> > document by simply searching "cat dog"
> > "cats are smaller than dogs"
> >
>
> Try this:
> /^\(.*cats.*\)\&\(.*dogs.*\)$
>
> This finds any line which contains cats and dogs in any order.
>
> regards,
> Christian
>

Yes, and I think that this pattern could be simplified to
/.*cats\&.*dogs
See similar example given by :help /\&

Greg

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment