On Thu, Oct 3, 2024 at 10:18 AM Tim Chase <vim@tim.thechases.com> wrote:
On 2024-10-03 15:09, Mikhail Velikikh wrote:
> > 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?
>
> I would use something like this:
> \v<(quick|brown|lazy|jumps)>
That finds *any* of the words, not *all* of the words as the OP requested.
While the implementation can often end up slow if you have a large
text or lots of find-them-all terms, you (OP) can use
:help /\&
to join the conditions like
/.\{-}quick\&.\{-}brown\&.\{-}lazy\&.\{-}jumps/
-tim
Thank you; that's exactly what I was looking for. It does slow down, though, as you said it might, once I add more words to it. I might write something that does the combination thing I was suggesting and time the two approaches, but with more than just two words: /quick.*brown\|brown.*quick/ vs. /.\{-}quick\&.\{-}brown}/
Best regards,
Salman
--
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/CANuxnEcXmK25RhOrXZ9eA0PnogP76DKMr9gsBuD4sgm%2Bw6q_5Q%40mail.gmail.com.
No comments:
Post a Comment