Re: BUG #13538: REGEX non-greedy is working incorrectly (and also greedy matches fail if non-greedy is present)

From: Christian Mächler <christian_maechler(at)hotmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #13538: REGEX non-greedy is working incorrectly (and also greedy matches fail if non-greedy is present)
Date: 2015-08-04 13:49:02
Message-ID: DUB128-W2990BB7605238976ADE6AEF8760@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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 , 3, def

abc0.123def applying the 2nd regex (with optional dot) --> , 3 ,

Although the 3rd group wasn't touched it changed it's behavior from geedy to non-greedy. abc, 0.123, def would be correct.

The behavior of the non-greedy group isn't correct either, because a match should return the FIRST match found, greedyness is only about the FOLLOWING characters, but because it will already find 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 help, because I think this is a pretty big issue, although not using regex atm.

Chris

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2015-08-04 14:58:57 Re: BUG #13538: REGEX non-greedy is working incorrectly (and also greedy matches fail if non-greedy is present)
Previous Message Heikki Linnakangas 2015-08-04 07:16:55 Re: [BUGS] BUG #13536: SQLParamData thows "Invalid Endian" error