pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeff Boes <jboes@nexcerpt.com>
To: pgsql-sql@postgresql.org
Subject: Re: "reverse()" on strings
Date: Mon, 26 Aug 2002 16:56:46 -0400
Message-ID: <ake4lb$20ed$1@news.hub.org> (raw)
References: <no.Yo.N.nN.0208261600250.2291-100000@business.com>

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



view thread (4+ messages)  latest in thread

Message-ID: <ake4lb$20ed$1@news.hub.org>
Permalink:  ../ake4lb$20ed$1@news.hub.org/
Also on:    postgresql.org/message-id/ake4lb$20ed$1@news.hub.org

 · 

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: jboes@nexcerpt.com
  Subject: Re: "reverse()" on strings
  In-Reply-To: <ake4lb$20ed$1@news.hub.org>

* 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