Re: patch adding new regexp functions

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: patch adding new regexp functions
Дата
Msg-id 20070215135535.GC4682@alvh.no-ip.org
обсуждение исходный текст
Ответ на Re: patch adding new regexp functions  (Jeremy Drake <pgsql@jdrake.com>)
Ответы Re: patch adding new regexp functions  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: patch adding new regexp functions  (Jeremy Drake <pgsql@jdrake.com>)
Список pgsql-patches
Jeremy Drake wrote:

> The functions added are:
> * regexp_split(str text, pattern text) RETURNS SETOF text
>   regexp_split(str text, pattern text, flags text) RETURNS SETOF text
>    returns each section of the string delimited by the pattern.
> * regexp_matches(str text, pattern text) RETURNS text[]
>    returns all capture groups when matching pattern against string in an
>    array
> * regexp_matches(str text, pattern text, flags text) RETURNS SETOF
>     (prematch text, fullmatch text, matches text[], postmatch text)
>    returns all capture groups when matching pattern against string in an
>    array.  also returns the entire match in fullmatch.  if the 'g' option
>    is given, returns all matches in the string.  if the 'r' option is
>    given, also return the text before and after the match in prematch and
>    postmatch respectively.

I think the position the match is in could be important.  I'm wondering
if you could define them like

create type re_match(match text, position int)
regexp_split(str text, pattern text) returns setof re_match

or maybe
regexp_split(str text, pattern text, OUT match text, OUT position int);
(not sure of the exact syntax for this one)

so that you would have the position for each match, automatically.  Is
this information available in the regex code?

--
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

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

Предыдущее
От: Magnus Hagander
Дата:
Сообщение: Move cursor support for pl/pgsql
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Autovacuum launcher