Monday, October 11, 2021

Re: Matching a non-match

Thanks to all who replied to my thread!

On Sun, 20 Dec 2020 at 17:30, Tim Chase <vim@tim.thechases.com> wrote:
>
> On 2020-12-20 11:09, A. Wik wrote:
> > Browsing a directory listing, sometimes I hit lines like these:
> > ./spool/exim/input/1FM8sl-00004n-Ix-H
> > ./spool/exim/input/1FM8sn-00004u-OF-D
> > ./spool/exim/input/1E9dsQ-00004f-MO-D
> > [... thousands of similar lines ...]
> >
> > How can I use "/" to find the next line not matching the above
> > pattern? I've tried the following (and several variations):
> > /\(.*exim.input\)\@<!.*
>
> you can use which only finds the start of the line:
>
> /^\%(.*exim.input\)\@!
>
> or if you want to match the entire line, you can use:
>
> /^\%(\%(exim.input\)\@!.\)*$/
>
> That breaks down to
>
> ^ from the start of the line
> \%(…\)* zero or more of these things
> \%(exim.match\)\@! at each of these places, this can't match
> . accept a character here
> $ all the way to the end of the line
> (no partial line matches, or it would find
> ".spool/exim/inpu" (because "exim.input" doesn't yet
> match)

Can you clarify the function of the dot? It appears that without it,
it finds only empty lines. With it, it finds any line not matching
"exim.input", including empty lines.

-aw

--
--
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/CALPW7mQjfOSkRpMzOWB0Na2SO5E33E5XAqQ2zwGOQn3e%2BMYzCQ%40mail.gmail.com.

No comments:

Post a Comment