Hi,

I would use something like this:
\v<(quick|brown|lazy|jumps)>

\v - very magic
< - the beginning of a word
> - the end of a word
(quick|brown|lazy|jumps) - the words to find

Thanks,
Mikhail Velikikh



On Thu, 3 Oct 2024 at 14:51, Salman Halim <[email protected]> wrote:

> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/vim_use/CANuxnEcUM43Z%3DOVF0cPXRGq_12NckWMHZBtdH0S_DpKOFJZUOg%40mail.gmail.com
> <https://groups.google.com/d/msgid/vim_use/CANuxnEcUM43Z%3DOVF0cPXRGq_12NckWMHZBtdH0S_DpKOFJZUOg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/CALe4HpnpJwixWbdeS72jh-oWERq3_pjURDRgGpLsU8FCP6UyZg%40mail.gmail.com.

Reply via email to