Re: trimming functions. - Mailing list pgsql-general

From Hubert Lubaczewski
Subject Re: trimming functions.
Date
Msg-id 20030623134746.1c3b38e0.hubert.lubaczewski@eo.pl
Whole thread Raw
In response to trimming functions.  (javier garcia - CEBAS <rn001@cebas.csic.es>)
List pgsql-general
On Mon, 23 Jun 2003 12:41:19 +0200
javier garcia - CEBAS <rn001@cebas.csic.es> wrote:

> So I still need to improve the SELECT to remove all possible symbols after
> the first group of alphabet characters to get a 'code_trimmed' column with
> just the characters:(NJ, AG, OL, LI, I, NJ, PH, AG, PD, L, M, MD, L).
> Possible 'non alphabet' symbols are '{+/^('
> Any idea?

simple pl/perl function should do the trick.

maybe something like this:
create function d_trim(text) returns text as '
    my $sString = shift;
    $sString =~ s/^\\(*([A-Z]+).*$/$1/;
    return $sString;
' language 'plperl';

i'm not entirelly sure if this function will work - i wrote it without anytesting, but it is so simple, one shouldn't
haveany problems correcting/modifying it's behaviour. 

depesz

pgsql-general by date:

Previous
From: The Hermit Hacker
Date:
Subject: Re: [pgsql-advocacy] interesting PHP/MySQL thread
Next
From: "Kallol Nandi"
Date:
Subject: Lotus Domino and PostgreSql in Linux