Re: "reverse()" on strings - Mailing list pgsql-sql

From Jeff Boes
Subject Re: "reverse()" on strings
Date
Msg-id ake4lb$20ed$1@news.hub.org
Whole thread Raw
In response to "reverse()" on strings  (h012@ied.com)
Responses Re: "reverse()" on strings  (Josh Berkus <josh@agliodbs.com>)
List pgsql-sql
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


pgsql-sql by date:

Previous
From: h012@ied.com
Date:
Subject: "reverse()" on strings
Next
From: Josh Berkus
Date:
Subject: Re: "reverse()" on strings