Saturday, September 20, 2014

Re: Searching for any one of a set or words ?

hi Philip,

On Sat, Sep 20, 2014 at 3:09 PM, Philip Rhoades <phil@pricom.com.au> wrote:
People,

If I have words in a file - either on the same or separate lines - is it possible, within vim (I could probably do what I want with a shell script and grep) to search for _any_ of the words in the set?

eg I have a file with words:

  quick fox lazy dog

and I have a text file open in vim with the lines

the
quick
brown
fox
jumps
over
the
lazy
dog

- I want my search to stop on "quick" then "fox" then "lazy" then "dog" when the search is repeated . . seems too hard to me . .

you could search with a regular expression, for example :

/\v(quick|fox|lazy|dog)

would work with your example (but does not handle word boundaries),

nico





 

Regards,

Phil.

--
Philip Rhoades

GPO Box 3411
Sydney NSW      2001
Australia
E-mail:  phil@pricom.com.au

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

--- You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: