Thursday, October 3, 2024

Re: Finding all words

Very good idea. Thanks again.

Salman

On Thu, Oct 3, 2024, 12:09 Tim Chase <vim@tim.thechases.com> wrote:
On 2024-10-03 11:58, Salman Halim wrote:
> >     /.\{-}quick\&.\{-}brown\&.\{-}lazy\&.\{-}jumps/

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

At the cost of some redundancy, you might be able to speed it up a
little bit by requiring that it start with at least one of the words
like

  /\%(\<\%(quick\|brown\|lazy\|jumps\)\>\)\@=\%(.\{-}quick\&.\{-}brown\&.\{-}lazy\&.\{-}jumps\)/

so it won't start looking for the other terms until it's found at
least one of them, cutting out a lot of non-starter cases.

-tim





--
--
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/Zv7Bt-O8KlBggCtX%40thechases.com.

--
--
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/CANuxnEeptRdJnWHNSPa2Kprm1By3VBf-_U2g5v%2BCq%2BK-g3Rr1A%40mail.gmail.com.

No comments:

Post a Comment