Re: REGEXP: returning match? - Mailing list pgsql-general

From Jeff Eckermann
Subject Re: REGEXP: returning match?
Date
Msg-id 20020920142150.87653.qmail@web20807.mail.yahoo.com
Whole thread Raw
In response to REGEXP: returning match?  (Jean-Christian Imbeault <jc@mega-bucks.co.jp>)
List pgsql-general
--- 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

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Problems with Triggers
Next
From: Tom Lane
Date:
Subject: Re: missed features and unhappy changes when pg 7.1->7.2