Re: Regex negative lookahead failed

Subject: Re: Regex negative lookahead failed

Date: Sat, 24 Apr 2021 12:52:02 -0400

To: David Bremner, notmuch@notmuchmail.org

Cc:

From: Erwan Hingant


Hello,

 Thanks a lot, this makes all clear and notmuch-search-terms(7) point the
 regex POSIX version you mention. My mistake. By the way, you completely
 solve my problem that of course no need regular expression has I
 thought...

Bests,
Erwan.

David Bremner <david@tethera.net> writes:

> Erwan Hingant <erwan.hingant@mailo.com> writes:
>
>> Hello,
>>
>>   I have some troubles with regex negative lookahead. When searching 
>> in 
>> all directories but one (say inbox), I do the following query:
>>
>>  > notmuch search folder:"/^(?!inbox)/"
>>
>
> As far as I know, lookaheads are not supported by POSIX regex, which is
> what notmuch uses. regex(7) is a bit terse, but the relevant section
> seems to be
>
>        An atom is a regular expression enclosed in "()" (matching a match  for
>        the  regular  expression),  an  empty  set  of  "()" (matching the null
>        string)(!), a bracket expression (see below), '.' (matching any  single
>        character),  '^' (matching the null string at the beginning of a line),
>        '$' (matching the null string at the end of a line), a '\' followed  by
>        one  of the characters "^.[$()|*+?{\" (matching that character taken as
>        an ordinary character),  a  '\'  followed  by  any  other  character(!)
>        (matching  that character taken as an ordinary character, as if the '\'
>        had not been present(!)), or a single character with no other  signifi‐
>        cance  (matching  that character).  A '{' followed by a character other
>        than a digit is an ordinary character, not the beginning of a bound(!).
>        It is illegal to end an RE with '\'.
>
> I'm not sure your whole problem, but maybe regex is not the right answer
> here. In general they should be a last resort in notmuch, for efficiency
> reasons. Does "not folder:inbox"  do what you want?

_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: