From: | Merlin Moncure <mmoncure(at)gmail(dot)com> |
---|---|
To: | Oliver Kohll - Mailing Lists <oliver(dot)lists(at)gtwm(dot)co(dot)uk> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Making substrings uppercase |
Date: | 2013-09-10 12:56:18 |
Message-ID: | CAHyXU0yF2VENROUL-b-TsqiHOFT-NJBL8B-HEuFHc8xRaa44ng@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Tue, Sep 10, 2013 at 5:51 AM, Oliver Kohll - Mailing Lists
<oliver(dot)lists(at)gtwm(dot)co(dot)uk> wrote:
> On 9 Sep 2013, at 21:03, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> wrote:
>
> select string_agg(case when words like '*%*' then upper(btrim(words, '*'))
> else words end, ' ')
> from regexp_split_to_table('The *quick* *brown* fox jumped over the *lazy*
> dog', ' ') as words;
>
> string_agg
> ----------------------------------------------
> The QUICK BROWN fox jumped over the LAZY dog
>
>
> That's quite elegant. In the end I exported and used PERL, as some of my
> 'words' had spaces (they were ingredients like monosodium glutamate), but
> you could probably do a more complex regex in regexp_split_to_table to cope
> with that, or use pl/perl as previously suggested.
IMO, pl/perl is the way to go. Being able to use postgres functions
to transform matched regex expressions would be just wonderful
although I wonder how fast it would be or if it's even possible.
merlin
From | Date | Subject | |
---|---|---|---|
Next Message | Vincent Veyron | 2013-09-10 13:09:31 | Re: Call for design: PostgreSQL mugs |
Previous Message | Oliver Kohll - Mailing Lists | 2013-09-10 10:51:15 | Re: Making substrings uppercase |