Oliver Kohll - Mailing Lists wrote:
> Hello,
>
> Given a string with certain words surrounded by stars, e.g.
>
> The *quick* *brown* fox jumped over the *lazy* dog
>
> can you transform the words surrounded by stars with uppercase versions, i.e.
Maybe you can turn that into a resultset, then uppercase individual
words, then join them back into a string. Something like
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
(1 fila)
This is a bit simplistic, but hopefully you get the idea.
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services