perlsub

From: Nabil Sayegh <postgresql(at)e-trolley(dot)de>
To: pgsql-novice(at)postgresql(dot)org
Subject: perlsub
Date: 2003-10-03 23:29:00
Message-ID: 3F7E063C.3040909@e-trolley.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hello again,

now that perlsub works i need to know how backreferences work with
plperl. $1 - $9 doesn't work. Any idea ?

perlsub:
-----------------------------------------------
CREATE FUNCTION perlsub(text, text, text) RETURNS text AS '
my ($data, $pat, $repl) = @_;
$data =~ s/$pat/$repl/;
return $data
' LANGUAGE 'plperl';
-----------------------------------------------

SELECT perlsub('a=b','([^=]+)=(.+)','key:$1;val:$2');

Any idea ? Just a matter of quoting ?
Also this example doesn't work with * instead of + :(

TIA
--
e-Trolley Sayegh & John, Nabil Sayegh
Tel.: 0700 etrolley /// 0700 38765539
Fax.: +49 69 8299381-8
PGP : http://www.e-trolley.de

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Oliver Elphick 2003-10-04 06:20:10 Re: perlsub
Previous Message Nabil Sayegh 2003-10-03 23:18:45 Re: plperl db crash