Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZMnOC-0007Qb-8g for pgsql-bugs@arkaria.postgresql.org; Wed, 05 Aug 2015 01:21:04 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZMnOB-0001i8-Ds for pgsql-bugs@arkaria.postgresql.org; Wed, 05 Aug 2015 01:21:03 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZMnOA-0001hs-RH for pgsql-bugs@postgresql.org; Wed, 05 Aug 2015 01:21:02 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZMnO2-0008Vt-TD for pgsql-bugs@postgresql.org; Wed, 05 Aug 2015 01:21:02 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id t751KpmG022209; Tue, 4 Aug 2015 21:20:51 -0400 From: Tom Lane To: "David G. Johnston" cc: =?UTF-8?Q?Christian_M=C3=A4chler?= , "pgsql-bugs@postgresql.org" Subject: Re: BUG #13538: REGEX non-greedy is working incorrectly (and also greedy matches fail if non-greedy is present) In-reply-to: References: <20150803224450.1115.8803@wrigleys.postgresql.org> <26003.1438700337@sss.pgh.pa.us> <32324.1438702786@sss.pgh.pa.us> Comments: In-reply-to "David G. Johnston" message dated "Tue, 04 Aug 2015 09:02:15 -0700" Date: Tue, 04 Aug 2015 21:20:51 -0400 Message-ID: <22208.1438737651@sss.pgh.pa.us> X-Pg-Spam-Score: -2.1 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org "David G. Johnston" writes: > On Tue, Aug 4, 2015 at 8:39 AM, Tom Lane wrote: >> BTW, perhaps it would be worth adding an example to that section that >> shows how to control this behavior. > +1 When I looked closer, I noticed that the docs already had a recommendation about how to force overall greediness or non-greediness, and it was cleaner than the \0* hack I'd come up with on the spur of the moment. So I extended that with an example. For-the-archives: it strikes me that if we ever did want to break backwards compatibility here in order to make it act a bit more like Perl's regexps, we could try making the concatenation rule be that the overall RE inherits the greediness of its last quantified atom rather than its first one. But I'm not sure how close an approximation that would produce to Perl's engine's behavior; there would probably still be some discrepancies. I doubt it's worth breaking backwards compatibility for, if we'd still get complaints from Perl users that our regex engine is broken because it's not bug-compatible with Perl's. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs