From: David Bremner <david@tethera.net>
To: Erwan Hingant <erwan.hingant@mailo.com>, notmuch@notmuchmail.org
Subject: Re: Regex negative lookahead failed
Date: Sat, 24 Apr 2021 07:57:17 -0300 [thread overview]
Message-ID: <87sg3g0x2q.fsf@tethera.net> (raw)
In-Reply-To: <faa3b934-ce05-01e5-9392-4dba06b8cf86@mailo.com>
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?
next prev parent reply other threads:[~2021-04-24 10:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-24 4:32 Regex negative lookahead failed Erwan Hingant
2021-04-24 10:57 ` David Bremner [this message]
2021-04-24 12:34 ` Michael J Gruber
2021-04-24 16:03 ` David Bremner
2021-04-24 16:52 ` Erwan Hingant
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87sg3g0x2q.fsf@tethera.net \
--to=david@tethera.net \
--cc=erwan.hingant@mailo.com \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).