From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 91DA86DE024C for ; Fri, 6 Apr 2018 10:55:06 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.03 X-Spam-Level: X-Spam-Status: No, score=-0.03 tagged_above=-999 required=5 tests=[AWL=0.280, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.211, SPF_PASS=-0.001] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id i3ztMdaInvV9 for ; Fri, 6 Apr 2018 10:55:05 -0700 (PDT) Received: from mail-wr0-f180.google.com (mail-wr0-f180.google.com [209.85.128.180]) by arlo.cworth.org (Postfix) with ESMTPS id 7CC476DE023F for ; Fri, 6 Apr 2018 10:55:05 -0700 (PDT) Received: by mail-wr0-f180.google.com with SMTP id d17so2515647wre.1 for ; Fri, 06 Apr 2018 10:55:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:references:to:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=sYVio33JinbqLCRPUBDMqtMZHKelnbzNISl/Ej1e3mw=; b=HOswUoz1I6peQYI2bOYQHTiT+tVFGTKqh0idXcccyz09zHz3EfmiMk+o2pEkI2IlLw ilmAWu/T8agXOlkmyI9t3vwdjeo4e2ahc3Zma5NIZUo5vQpp559Yn3MHSF4ifNTbyUKD tCRQo2hechMG+hNgNAgCot5bQPEzlTL7p00ifMABvEJfcs7twJ0V0Q+aYckWgbqy8tFm wi6aT1GrNkz+FaLmZxMecbCYYS0Pf4+AY82pLJqKy/zLL21irE3FMdtyMLLTG+7v5DxQ yI2u8syShyM1Vdx19A90oPgz7SGeX2MZ02DzPEcRo+/mq/Vxg1b74RGLoriw70Vx5RP8 45hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:references:to:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=sYVio33JinbqLCRPUBDMqtMZHKelnbzNISl/Ej1e3mw=; b=m5A8+BOUzToAqwFh/1pDhkm67rDSZp+LH2aj+NpXsF6pZ7NfvGyVTpdrVpQhGlh9Qg TNPwVPwfI2M3zKKXl0gUk49YqYH6pO6L687d2T8hvEsmQM3Qwk0Ql8/CrJUBVWbu/7Oq QQ1xln3lYgZ2nzGW6nKMDQOVKYSIY2VRiEX8RFWsc8/t8jbGrtMo9jKDJF95agXDqKyc SsChqEwRAap5szky8l5r5fjkrPlpKWa4V9kEG8NeG0CZa0sQxB5oqYiChTakrYRCXT/l ycX/2EgVY8FYEiN3sJMEUmw47dFZkfwXKKn1wwh6zx6kiW9kKmdkt/Eow6ByY8dox+EU Rmog== X-Gm-Message-State: AElRT7HTpCq2lTOyPmrvhVpNUBP2ba982t1ynlXTA3GRECcLXVqXOlHz 1LEXFuBS/JmsPydXa0U/QWo1NRe3 X-Google-Smtp-Source: AIpwx48JxaiSSDU6KpRlC5eyRZjLxFer/+Bcx4KPjOUscKN8IenqqLUZEw73E0KUiRgKVtoyhJNCEw== X-Received: by 10.223.208.202 with SMTP id z10mr22390899wrh.15.1523037303333; Fri, 06 Apr 2018 10:55:03 -0700 (PDT) Received: from localhost.localdomain ([87.124.229.17]) by smtp.gmail.com with ESMTPSA id 55sm21697685wrw.52.2018.04.06.10.55.02 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Apr 2018 10:55:02 -0700 (PDT) Subject: Re: Xapian regex with parentheses fails References: To: notmuch@notmuchmail.org From: Javier Garcia X-Forwarded-Message-Id: Message-ID: <83f18ad4-65df-2e84-587d-04658d371462@gmail.com> Date: Fri, 6 Apr 2018 19:55:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------8C7097C39D5491B648CA6504" Content-Language: en-US X-Mailman-Approved-At: Fri, 06 Apr 2018 14:11:40 -0700 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 17:55:06 -0000 This is a multi-part message in MIME format. --------------8C7097C39D5491B648CA6504 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Fantastic, it works! Just as a suggestion, maybe this tip can be included in the man pages. Something on the lines of: Use *folder:"//"* in case the regex contains special characters interpretable by Xapian. Double escape as necesary. For instance: notmuch search 'folder:"/^.*/(Junk|Spam)$/"' On 06/04/18 17:36, David Bremner wrote: > Javier Garcia writes: > >> Hi, >> >> I'm configuring notmuch in a multi-account directory. I want it to tag >> spam and deleted mails using a post hook. Using regexes with parentheses >> fails, or perhaps I misunderstood the documentation. The following one >> liner replicates the problem I face. >> >> $ notmuch search 'folder:/^.*/(Junk|Spam)$/' >> notmuch search: A Xapian exception occurred >> A Xapian exception occurred parsing query: unmatched regex delimiter in >> '/^.*/(Junk|Spam' >> Query string was: folder:/^.*/(Junk|Spam)$/ > Try > > notmuch search 'folder:"/^.*/(Junk|Spam)$/"' > --------------8C7097C39D5491B648CA6504 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit Fantastic, it works!

Just as a suggestion, maybe this tip can be included in the man pages. Something on the lines of:

Use folder:"/<regex>/" in case the regex contains special characters interpretable by Xapian. Double escape as necesary. For instance:

notmuch search 'folder:"/^.*/(Junk|Spam)$/"'

On 06/04/18 17:36, David Bremner wrote:
Javier Garcia <javiertury@gmail.com> writes:

Hi,

I'm configuring notmuch in a multi-account directory. I want it to tag
spam and deleted mails using a post hook. Using regexes with parentheses
fails, or perhaps I misunderstood the documentation. The following one
liner replicates the problem I face.

$ notmuch search 'folder:/^.*/(Junk|Spam)$/'
notmuch search: A Xapian exception occurred
A Xapian exception occurred parsing query: unmatched regex delimiter in
'/^.*/(Junk|Spam'
Query string was: folder:/^.*/(Junk|Spam)$/
Try

 notmuch search 'folder:"/^.*/(Junk|Spam)$/"'
 

--------------8C7097C39D5491B648CA6504--