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 C85E86DE0946 for ; Wed, 25 Jan 2017 18:21:39 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.005 X-Spam-Level: X-Spam-Status: No, score=-0.005 tagged_above=-999 required=5 tests=[AWL=0.006, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] 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 q4-sP_lB5-ja for ; Wed, 25 Jan 2017 18:21:37 -0800 (PST) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id 197436DE0318 for ; Wed, 25 Jan 2017 18:21:37 -0800 (PST) Received: from remotemail by fethera.tethera.net with local (Exim 4.84_2) (envelope-from ) id 1cWZgN-0003fG-35; Wed, 25 Jan 2017 21:21:03 -0500 Received: (nullmailer pid 6020 invoked by uid 1000); Thu, 26 Jan 2017 02:21:32 -0000 From: David Bremner To: Tomi Ollila , notmuch@notmuchmail.org Subject: Re: [Patch v4] lib: regexp matching in 'subject' and 'from' In-Reply-To: References: <20170121032752.6788-1-david@tethera.net> <20170121135917.22062-1-david@tethera.net> Date: Wed, 25 Jan 2017 22:21:32 -0400 Message-ID: <87efzqef2r.fsf@tethera.net> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.22 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: Thu, 26 Jan 2017 02:21:39 -0000 Tomi Ollila writes: > > Why would not mesasge_id not be useful to regex match. I can come up quite > a few use cases... but if there are techinal difficulties... then that > should be mentioned instead. I'll have a look. Since the first version of this patch (when that message was written), people have actually asked for some kind of wildcard matching of message-ids. > > maybe this commit message should inform that xapian with field processors > (1.4.x) is required for this feature -- and emphasize it a bit better in > manual page ? > > Probably '//' is used to escape '/' -- should such a character ever needed > in regex search. > Currently no escaping is needed because it only looks at the first and last characters of the string (the usual xapian/shell rules mean that "" might be needed). The following seem to work as hoped # match a / with a space before it % notmuch search 'subject:"/ //"' # just a slash % notmuch search subject:/// # anchored slash % notmuch search subject:/^// The trailing slash is actually decorative, we could drop it. Actually *blush* I just noticed the current code is missing something from this line if (str.at (0) == '/' && str.at (str.size () - 1)){ _if_ that line is fixed, then it will have the slightly odd behaviour of subject:/blah doing a non-regex search We could also throw an error for that case, maybe that's the best option.