Xapian regex with parentheses fails

Javier Garcia javiertury at gmail.com
Fri Apr 6 10:55:01 PDT 2018

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 at 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)$/"'

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20180406/0751a2ae/attachment.html>

More information about the notmuch mailing list