--- /dev/null
+Return-Path: <fatkasuvayu+linux@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 9AC646DE1639\r
+ for <notmuch@notmuchmail.org>; Sun, 14 Jun 2015 16:50:00 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.719\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.719 tagged_above=-999 required=5 tests=[AWL=0.101,\r
+ DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001,\r
+ RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01,\r
+ SPF_PASS=-0.001] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id jUtH6iQPCB9T for <notmuch@notmuchmail.org>;\r
+ Sun, 14 Jun 2015 16:49:58 -0700 (PDT)\r
+Received: from mail-wi0-f178.google.com (mail-wi0-f178.google.com\r
+ [209.85.212.178])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 6914A6DE15E3\r
+ for <notmuch@notmuchmail.org>; Sun, 14 Jun 2015 16:49:58 -0700 (PDT)\r
+Received: by wicnd19 with SMTP id nd19so9676108wic.1\r
+ for <notmuch@notmuchmail.org>; Sun, 14 Jun 2015 16:49:55 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=sender:date:from:to:subject:message-id:mail-followup-to:references\r
+ :mime-version:content-type:content-disposition\r
+ :content-transfer-encoding:in-reply-to:user-agent;\r
+ bh=SA94LCKxYF9hO//cGD2m1h2e51FcH4zSo61BLYzvLJE=;\r
+ b=L8yRAMCpYeCg+1DSW7osrG0YVtQo8r+fYP1f2bjQURGuKaGbVJpFj4eSzZ+Rha8VcH\r
+ xz3VDrmULu2ys0Lwz6zBme+AVwz66l0Gu/ULgNd5RZ3GtjpN5dtAUWHxDhoUcSFYlEls\r
+ jZzAutXS05T5hcSqBbKBDaDYo9iErbXSGb96yXoTsxhHkSpyNfe/+OyBJnx9gtzzQVnh\r
+ Kf8C9SOIyIuKWF5cg15hS8tmY7QDGwUKhqdyOlxZeDLvlkR9rugxjHn/s/Jp3OuFXBD9\r
+ rox9CjH8hGsrcRHSFtAtbP6FxfJs846Ckx7DvkF4apFyRJZd0d9QHb+5b6itgqMoOaid\r
+ vWmw==\r
+X-Received: by 10.181.11.129 with SMTP id ei1mr25959048wid.90.1434325795112;\r
+ Sun, 14 Jun 2015 16:49:55 -0700 (PDT)\r
+Received: from chitra.no-ip.org (ip82-139-115-46.lijbrandt.net.\r
+ [82.139.115.46])\r
+ by mx.google.com with ESMTPSA id c3sm16322989wja.3.2015.06.14.16.49.54\r
+ for <notmuch@notmuchmail.org>\r
+ (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
+ Sun, 14 Jun 2015 16:49:54 -0700 (PDT)\r
+Sender: Suvayu Ali <fatkasuvayu@gmail.com>\r
+Date: Mon, 15 Jun 2015 01:49:52 +0200\r
+From: Suvayu Ali <fatkasuvayu+linux@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: Re: search query "replytoid:<blah>"\r
+Message-ID: <20150614234952.GA4315@chitra.no-ip.org>\r
+Mail-Followup-To: notmuch@notmuchmail.org\r
+References:\r
+ <CAJhTkNhYew6H-bptACTew3gN3DLWg6agTYu8hAkdwFS=z4VFWg@mail.gmail.com>\r
+ <20150613205552.GC17381@chitra.no-ip.org>\r
+ <20150614082258.GD17381@chitra.no-ip.org>\r
+ <20150614223057.GB21261@boo.workgroup>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Disposition: inline\r
+Content-Transfer-Encoding: 8bit\r
+In-Reply-To: <20150614223057.GB21261@boo.workgroup>\r
+User-Agent: Mutt/1.5.23.1 (2014-03-12)\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.18\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 14 Jun 2015 23:50:00 -0000\r
+\r
+Hi,\r
+\r
+On Mon, Jun 15, 2015 at 12:30:57AM +0200, Gregor Zattler wrote:\r
+> \r
+> This is a nice script. The very first Message(-Id:) I tried was\r
+> replied to by a message with this In-Reply-To: header:\r
+> \r
+> In-Reply-To: <7e093509.51e.14ddb300091.Coremail.chxp_moon@163.com> (windy’s\r
+> message of „Wed, 10 Jun 2015 09:57:45 +0800 (CST)“)\r
+> \r
+> Since the script extracts Message-Id:s from In-Reply-To; headers via\r
+> \r
+> > function strip_mid() {\r
+> > sed -e 's/[<> ]//g'\r
+> > }\r
+> \r
+> the Message-Id:s did not match. I therefore changed this to\r
+> \r
+> function strip_mid() {\r
+> egrep -a -o "<[^[:space:]<>]+@[^@[:space:]<>]+>"|sed -e 's/[<> ]//g'\r
+> }\r
+\r
+It was a quick hack. In fact, there is another limitation. IIRC, I\r
+think the In-Reply-To header can have multiple Message-Id-s. That is\r
+not handled at all! \r
+\r
+The correct logic to get the ids should probably be something that picks\r
+out the content inside angular brackets, but non-greedily. Note that,\r
+the allowance of characters inside Message-ID-s is rather liberal. I\r
+think it can be anything other than whitespace or angular brackets.\r
+What you do above is probably very close, but still not general enough.\r
+In fact, I think the foo@domain structure you require is not mandatory!\r
+In my opinion, one should use an email handling library, or better yet\r
+use the python bindings.\r
+\r
+For the sake of completeness, here is a pure sed solution:\r
+\r
+ function strip_mid() {\r
+ sed -e 's/ \+//g' -e 's/<\([^ <>]\+\)>/\1/g'\r
+ }\r
+\r
+;)\r
+\r
+-- \r
+Suvayu\r
+\r
+Open source is the future. It sets us free.\r