On 2021-10-11 23:45, A. Wik wrote:
> > 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.
Sorry for the late reply. The "." is what lets the regex move
forward, roughly stating ".*" but at each of those "." locations,
before we accept that location, we assert that "exim.match" can't
match at that particular character.
this line contains exim match here
when the regex engine gets to the "e" in "exim match", the \@!
assertion fails, so the regex doesn't match that line, but on a line
like
hello
it starts at the beginning. /exim.match/ doesn't match there so the
"." accepts the "h", moving to the next char. /exim.match/ doesn't
match there either, so the "." accepts the "e". Repeat until it gets
to the end, having asserted that each ".", no /exim.match/ exists.
Hope that helps make a bit of sense of it?
-tim