pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: Christian Mächler <christian_maechler@hotmail.com>
Cc: pgsql-bugs@postgresql.org <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, 04 Aug 2015 21:20:51 -0400
Message-ID: <22208.1438737651@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKFQuwbn0nYSQL99rn=WSsfKYrSra5cd3GiQ3iH_rnHHGic1_g@mail.gmail.com>
References: <20150803224450.1115.8803@wrigleys.postgresql.org>
	<CAKFQuwaXQvXx9OEDNXAA5eXdbP0CKBnWow+L0aoh1vH2J6LrtQ@mail.gmail.com>
	<DUB128-W2990BB7605238976ADE6AEF8760@phx.gbl>
	<26003.1438700337@sss.pgh.pa.us>
	<32324.1438702786@sss.pgh.pa.us>
	<CAKFQuwbn0nYSQL99rn=WSsfKYrSra5cd3GiQ3iH_rnHHGic1_g@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Tue, Aug 4, 2015 at 8:39 AM, Tom Lane <tgl@sss.pgh.pa.us> 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



view thread (10+ messages)  latest in thread

Message-ID: <22208.1438737651@sss.pgh.pa.us>
Permalink:  ../22208.1438737651@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/22208.1438737651@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, david.g.johnston@gmail.com, christian_maechler@hotmail.com
  Subject: Re: BUG #13538: REGEX non-greedy is working incorrectly (and also greedy matches fail if non-greedy is present)
  In-Reply-To: <22208.1438737651@sss.pgh.pa.us>
  References: <20150803224450.1115.8803@wrigleys.postgresql.org> <CAKFQuwaXQvXx9OEDNXAA5eXdbP0CKBnWow+L0aoh1vH2J6LrtQ@mail.gmail.com> <DUB128-W2990BB7605238976ADE6AEF8760@phx.gbl> <26003.1438700337@sss.pgh.pa.us> <32324.1438702786@sss.pgh.pa.us> <CAKFQuwbn0nYSQL99rn=WSsfKYrSra5cd3GiQ3iH_rnHHGic1_g@mail.gmail.com> <22208.1438737651@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox