Thursday, October 3, 2024

Finding all words

Hello,

Is there a way to compose a regular expression in Vim that will find all the words I want, irrespective of the order in which they occur? For example:

Some text...
The quick red fox jumps over the lazy brown dogs.
Some other text...

I want to find 'quick', 'brown', 'lazy' and 'jumps'. I don't know the order in which they occur, so something like 'quick.*brown.*lazy.*jumps' won't work. I'm trying to avoid a complicated/ugly expression that includes all possible orderings like '\%(brown.*lazy\)\|\%(lazy.*brown\)'.

I'm hoping there is a more graceful way to do this already. I'm happy to write a function to convert a sequence of words to an expression, even if it's the 'all combinations' one.

Thank you,

--
 
Salman

I, too, shall something make and glory in the making.

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CANuxnEcUM43Z%3DOVF0cPXRGq_12NckWMHZBtdH0S_DpKOFJZUOg%40mail.gmail.com.

No comments: