unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* Xapian regex with parentheses fails
@ 2018-04-04 23:20 Javier Garcia
  2018-04-06 15:36 ` David Bremner
  0 siblings, 1 reply; 3+ messages in thread
From: Javier Garcia @ 2018-04-04 23:20 UTC (permalink / raw)
  To: notmuch

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)$/

Javier

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Xapian regex with parentheses fails
  2018-04-04 23:20 Xapian regex with parentheses fails Javier Garcia
@ 2018-04-06 15:36 ` David Bremner
  0 siblings, 0 replies; 3+ messages in thread
From: David Bremner @ 2018-04-06 15:36 UTC (permalink / raw)
  To: Javier Garcia, notmuch

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Xapian regex with parentheses fails
       [not found] <cd83e4af-3c0b-ad0a-57a3-244c3dca9297@gmail.com>
@ 2018-04-06 17:55 ` Javier Garcia
  0 siblings, 0 replies; 3+ messages in thread
From: Javier Garcia @ 2018-04-06 17:55 UTC (permalink / raw)
  To: notmuch

[-- Attachment #1: Type: text/plain, Size: 970 bytes --]

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


[-- Attachment #2: Type: text/html, Size: 1638 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-04-06 17:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-04 23:20 Xapian regex with parentheses fails Javier Garcia
2018-04-06 15:36 ` David Bremner
     [not found] <cd83e4af-3c0b-ad0a-57a3-244c3dca9297@gmail.com>
2018-04-06 17:55 ` Javier Garcia

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).