problem with non-greedy regex match

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема problem with non-greedy regex match
Дата
Msg-id b42b73150901131139v4106f749h2d493135e1528234@mail.gmail.com
обсуждение исходный текст
Ответы Re: problem with non-greedy regex match  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
I _may_ have found a problem that is affecting non-greedy regex matches.

select regexp_matches(
  $$x = foo y x = foo y $$,
  $$x\s+(.*?)y$$  ,'g');

As I read it, this should match ' = foo' twice.  Instead, it matches
"= foo y x = foo " once.  The non-greedy form (.*?) should break out
at the first 'y'.

Interestingly, this works:
select regexp_matches(
  $$x = foo y x = foo y $$,
  $$x(.*?)y$$  ,'g');

It's the same regex minus the space after 'x'.

merlin

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #4613: intarray_del_elem returns an invalid empty array (for nullif comparison)
Следующее
От: Tom Lane
Дата:
Сообщение: Re: problem with non-greedy regex match