Sunday, December 20, 2020

Re: Matching a non-match

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)

-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/20201220113045.1c3bafc6%40bigbox.attlocal.net.

No comments:

Post a Comment