select regexp_matches('a a a', '([a-z]) a','g');

Поиск
Список
Период
Сортировка
От Marc Mamin
Тема select regexp_matches('a a a', '([a-z]) a','g');
Дата
Msg-id C4DAC901169B624F933534A26ED7DF31010A50FF@JENMAIL01.ad.intershop.net
обсуждение исходный текст
Ответ на Distinct oddity  (Maximilian Tyrtania <maximilian.tyrtania@onlinehome.de>)
Список pgsql-sql
Hello,

I wonder if someone has an idea for this problem:

I have a string that contains a serie of chars, separated by single
spaces.

e.g 'a b x n r a b c b'

Having such a string, I d'like to get a list of all predecessors of a
given character.
In the example, the predecessors of b  are a,a,c.

If I now have the string 'a a a', the predecessors of 'a' are a,a

I tried to use regexp_matches for this:

select regexp_matches('a a a', '([a-z]) a','g');
=> {"a "} only

As the second parameter of the function matches the first 2 'a',
only the trailing ' a' will be used to seek for further matching...

Cheers,

Marc Mamin


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

Предыдущее
От: Ian Barwick
Дата:
Сообщение: Re: ask about epoch query with datetime
Следующее
От: Scott Marlowe
Дата:
Сообщение: Re: Distinct oddity