Wednesday, June 2, 2010

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

thanks for the prompt reply! i really appreciate it. it worked
perfectly, however it didnt require the "$" sign?

also, how would u do it so that its not case sensitive? so it will
return a line with CaTs and DOGS

further, how do you become better at using such an editor as vim? I
only know some basic stuff for c programming and when i need to do
something like search/replace, i just google it. is there a good guide
to start with? I mean that statement u wrote just then was quite
complex for me to even understand lol

On Jun 3, 1:00 am, "Christian Brabandt" <cbli...@256bit.org> wrote:
> 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.
>
> > All editors I come across only allows you to search for an exact match
> > of that field "cat dog" in any line.
>
> There are probably several editors, that support regular expressions.
> though probably not all of them have a that powerful RE-engine as Vim.
>
> regards,
> Christian

--
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