Re: REGEXP: returning match?

From: Jeff Eckermann <jeff_eckermann(at)yahoo(dot)com>
To: Jean-Christian Imbeault <jc(at)mega-bucks(dot)co(dot)jp>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: REGEXP: returning match?
Date: 2002-09-20 14:21:50
Message-ID: 20020920142150.87653.qmail@web20807.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


--- Jean-Christian Imbeault <jc(at)mega-bucks(dot)co(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2002-09-20 14:34:44 Re: missed features and unhappy changes when pg 7.1->7.2
Previous Message Tom Lane 2002-09-20 14:08:45 Re: Problems with Triggers