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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #13538: REGEX non-greedy is working incorrectly (and also greedy matches fail if non-greedy is present)
Дата
Msg-id 22208.1438737651@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #13538: REGEX non-greedy is working incorrectly (and also greedy matches fail if non-greedy is present)  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: BUG #13538: REGEX non-greedy is working incorrectly (and also greedy matches fail if non-greedy is present)
Список pgsql-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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: BUG #13533: jsonb_populate_record does not work when the value is a simple string
Следующее
От: John R Pierce
Дата:
Сообщение: Re: BUG #13538: REGEX non-greedy is working incorrectly (and also greedy matches fail if non-greedy is present)