perlsub - Mailing list pgsql-novice

From Nabil Sayegh
Subject perlsub
Date
Msg-id 3F7E063C.3040909@e-trolley.de
Whole thread Raw
Responses Re: perlsub  (Oliver Elphick <olly@lfix.co.uk>)
Re: perlsub  (Martin_vi_Lange@t-online.de (Martin Lange))
List 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


pgsql-novice by date:

Previous
From: Nabil Sayegh
Date:
Subject: Re: plperl db crash
Next
From: Oliver Elphick
Date:
Subject: Re: perlsub