X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1A2B1D1B385 for ; Thu, 22 Jul 2004 11:52:19 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 80434-09 for ; Thu, 22 Jul 2004 14:52:18 +0000 (GMT) Received: from 192.168.1.80 (unknown [66.207.200.34]) by svr1.postgresql.org (Postfix) with ESMTP id 24AC8D1B380 for ; Thu, 22 Jul 2004 11:52:09 -0300 (ADT) Received: by 192.168.1.80 (Postfix, from userid 500) id E3EE36A347; Thu, 22 Jul 2004 10:49:53 -0400 (EDT) Subject: Converting a plperlu function to a plpgsql function From: Devin Whalen Reply-To: devin@synapticvision.com To: pgsql-sql@postgresql.org Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: Synaptic Vision Message-Id: <1090507793.7474.27.camel@192.168.1.80> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6-2mdk Date: Thu, 22 Jul 2004 10:49:53 -0400 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200407/181 X-Sequence-Number: 18433 Hello, I am trying to convert a database function that is written in perl to a PL/pgSQL function. However, there a a couple of lines that I don't think can be converted. First line: my @active_tables=split(/,/,$tables); Is there anyway to split a variable like the perl split above? Second line: if ($r=~/^-([0-9]?)([A-z_]+)/) { my $locid = $1; my $table = $2; Is there any way to to regular expressions similar to above. I need to be able to save the matches for later use. I know you can do regular expressions in sql but I can't find any equivalent for the above. Now you may be saying that why don't I just leave it in perl? Well, I would like to but my boss wants me to convert this to PL/pgSQL....long story. Anyway, if it can't be done it can't be done. But I was just wondering if anyone has any advice. Thanks for the help. Later -- Devin Whalen Programmer Synaptic Vision Inc Phone-(416) 539-0801 Fax- (416) 539-8280 1179A King St. West Toronto, Ontario Suite 309 M6K 3C5 Home-(416) 653-3982