pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jeff Eckermann <jeff_eckermann@yahoo.com>
Cc: devin@synapticvision.com
Cc: pgsql-sql@postgresql.org
Subject: Re: Converting a plperlu function to a plpgsql function
Date: Thu, 22 Jul 2004 16:34:05 -0400
Message-ID: <12272.1090528445@sss.pgh.pa.us> (raw)
In-Reply-To: <20040722190916.89900.qmail@web20824.mail.yahoo.com>
References: <20040722190916.89900.qmail@web20824.mail.yahoo.com>

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



view thread (5+ messages)

Message-ID: <12272.1090528445@sss.pgh.pa.us>
Permalink:  ../12272.1090528445@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/12272.1090528445@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, jeff_eckermann@yahoo.com, devin@synapticvision.com
  Subject: Re: Converting a plperlu function to a plpgsql function
  In-Reply-To: <12272.1090528445@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox