Jeff Eckermann <jeff_eckermann(at)yahoo(dot)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