Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZMdOR-0002RH-HX for pgsql-bugs@arkaria.postgresql.org; Tue, 04 Aug 2015 14:40:39 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZMdOQ-0005nB-MN for pgsql-bugs@arkaria.postgresql.org; Tue, 04 Aug 2015 14:40:38 +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 1ZMcaa-0002i4-Lj for pgsql-bugs@postgresql.org; Tue, 04 Aug 2015 13:49:08 +0000 Received: from dub004-omc3s21.hotmail.com ([157.55.2.30]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZMcaV-0003Lz-No for pgsql-bugs@postgresql.org; Tue, 04 Aug 2015 13:49:08 +0000 Received: from DUB128-W29 ([157.55.2.8]) by DUB004-OMC3S21.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Tue, 4 Aug 2015 06:49:02 -0700 X-TMN: [fykfzXQke4H/aR/fq4SbZNF6aVxNCzla] X-Originating-Email: [christian_maechler@hotmail.com] Message-ID: Content-Type: multipart/alternative; boundary="_f5cffde6-eccf-433f-b581-9e14106add60_" From: =?iso-8859-1?B?Q2hyaXN0aWFuIE3kY2hsZXI=?= To: "David G. Johnston" CC: "pgsql-bugs@postgresql.org" Subject: Re: BUG #13538: REGEX non-greedy is working incorrectly (and also greedy matches fail if non-greedy is present) Date: Tue, 4 Aug 2015 15:49:02 +0200 Importance: Normal In-Reply-To: References: <20150803224450.1115.8803@wrigleys.postgresql.org>, MIME-Version: 1.0 X-OriginalArrivalTime: 04 Aug 2015 13:49:02.0546 (UTC) FILETIME=[5267EB20:01D0CEBC] X-Pg-Spam-Score: -2.8 (--) 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 --_f5cffde6-eccf-433f-b581-9e14106add60_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sorry probably sent my mail to the wrong address before. Here some more detailed examples to show why the behavior of the 3rd group = is clearly wrong also according to the specification: abc0.123def applying the first regex (with optional dot)--> abc0.12 =2C 3= =2C def abc0.123def applying the 2nd regex (with optional dot) --> =2C 3 =2C Although the 3rd group wasn't touched it changed it's behavior from geedy t= o non-greedy. abc=2C 0.123=2C def would be correct. The behavior of the non-greedy group isn't correct either=2C because a matc= h should return the FIRST match found=2C greedyness is only about the FOLLO= WING characters=2C but because it will already find a match at start positi= on it should return that and not keep looking to find another match with re= duced group size. I was just trying to help=2C because I think this is a pretty big issue=2C = although not using regex atm. Chris = --_f5cffde6-eccf-433f-b581-9e14106add60_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Sorry probably sent my mail to t= he wrong address before.

Here some more detailed examples to show wh= y the behavior of the 3rd group is clearly wrong also according to the spec= ification:

abc0.123def applying the first regex (with optional dot)-= ->=3B abc0.12 =2C 3=2C def

abc0.123def applying the 2nd regex (wit= h optional dot) -->=3B =2C 3 =2C

Although the 3rd group wasn't tou= ched it changed it's behavior from geedy to non-greedy. abc=2C 0.123=2C def= would be correct.

The behavior of the non-greedy group isn't correc= t either=2C because a match should return the FIRST match found=2C greedyne= ss is only about the FOLLOWING characters=2C but because it will already fi= nd a match at start position it should return that and not keep looking to = find another match with reduced group size.

I was just trying to hel= p=2C because I think this is a pretty big issue=2C although not using regex= atm.

Chris
= --_f5cffde6-eccf-433f-b581-9e14106add60_--