Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 744544760B9 for ; Mon, 26 Aug 2002 16:56:14 -0400 (EDT) Received: from news.hub.org (news.hub.org [64.49.215.80]) by postgresql.org (Postfix) with ESMTP id 0E138475FE1 for ; Mon, 26 Aug 2002 16:56:14 -0400 (EDT) Received: by news.hub.org (Postfix, from userid 8) id DBFBF381C70; Mon, 26 Aug 2002 16:56:12 -0400 (EDT) From: Jeff Boes X-Newsgroups: comp.databases.postgresql.sql Subject: Re: "reverse()" on strings Date: Mon, 26 Aug 2002 16:56:46 -0400 Organization: Nexcerpt, Inc. Lines: 30 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Complaints-To: news@hub.org User-Agent: Pan/0.11.3 (Unix) X-Comment-To: "h012" To: pgsql-sql@postgresql.org X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200208/358 X-Sequence-Number: 9204 On Mon, 26 Aug 2002 16:13:44 -0400, h012 wrote: > CREATE INDEX extension_idx ON file (reverse(name)); > -- but I didn't find a function called "reverse" > > CREATE INDEX extension_idx ON file (regex_match( '.*(\.[^\.]*)$' ); > -- but I didn't find a function called "regex_match" which would return > string matched in brackets () > You probably want to do a $ createlang plperl and then something like this: CREATE FUNCTION fn_strrev(text) returns text as ' return reverse($_[0]) ' language 'plperl' with (iscachable); The same approach can be used to provide a regex match with Perl syntax, but I don't have an example of that coded up and at hand. -- Jeff Boes vox 269.226.9550 ext 24 Database Engineer fax 269.349.9076 Nexcerpt, Inc. http://www.nexcerpt.com ...Nexcerpt... Extend your Expertise