Re: Converting a plperlu function to a plpgsql function - Mailing list pgsql-sql

From Tom Lane
Subject Re: Converting a plperlu function to a plpgsql function
Date
Msg-id 12272.1090528445@sss.pgh.pa.us
Whole thread Raw
In response to Re: Converting a plperlu function to a plpgsql function  (Jeff Eckermann <jeff_eckermann@yahoo.com>)
List pgsql-sql
Jeff Eckermann <jeff_eckermann@yahoo.com> writes:
>> Second line:
>> 
>> if ($r=~/^-([0-9]?)([A-z_]+)/)
>> {
>>      my $locid = $1;
>>      my $table = $2;

> PostgreSQL doesn't offer capturing parentheses.

Hm?  See the substring function:

regression=# select substring('foobar' from 'o(.)a');substring
-----------b
(1 row)

You'd have to use it twice to collect two separate substrings, which is
mildly annoying, but it's hard to see how to do better without bizarre
behind-the-scenes stuff (like Perl's magic $n variables).
        regards, tom lane


pgsql-sql by date:

Previous
From: Devin Whalen
Date:
Subject: Re: Converting a plperlu function to a plpgsql function
Next
From: "Chris Cox"
Date:
Subject: Re: LIKE on index not working