Обсуждение: REGEXP: returning match?

Поиск
Список
Период
Сортировка

REGEXP: returning match?

От
Jean-Christian Imbeault
Дата:
Is there a simple way to get psql to return the part that match a query
containing a regexp?

Jc


Re: REGEXP: returning match?

От
Jeff Eckermann
Дата:
--- Jean-Christian Imbeault <jc@mega-bucks.co.jp>
wrote:
> Is there a simple way to get psql to return the part
> that match a query
> containing a regexp?
>

CREATE FUNCTION str_capture(text, text) RETURNS text
AS '
$_[0] =~ m/($_[1])/;
return $1;
' LANGUAGE 'plperl';

__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com