Re: Our regex vs. POSIX on "longest match"

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: depesz(at)depesz(dot)com
Cc: Brendan Jurd <direvus(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Our regex vs. POSIX on "longest match"
Date: 2012-03-04 20:20:03
Message-ID: 2033.1330892403@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

hubert depesz lubaczewski <depesz(at)depesz(dot)com> writes:
> I stand on position that mixing greedy and non-greedy operators should
> be possible, and that it should work according to POLA - i.e. greedines
> of given atom shouldn't be influenced by other atoms.

[ shrug... ] That sounds good, but it's pretty much vacuous as far as
defining a principled alternative behavior goes. It's easy to
demonstrate cases where atoms *must* be influenced by other ones.
A trivial example is
(.*)(.*)
It doesn't matter whether the second atom is greedy or not: it's not
going to get to eat anything because the first one does instead.
IOW this is just the same as
(.*)(.*?)
--- they are both overall-greedy.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-03-04 20:41:37 Re: Collect frequency statistics for arrays
Previous Message Heikki Linnakangas 2012-03-04 19:41:22 Re: xlog min recovery request ... is past current point ...