Re: [GENERAL] Making substrings uppercase

2013-09-10 Thread Merlin Moncure
On Tue, Sep 10, 2013 at 5:51 AM, Oliver Kohll - Mailing Lists wrote: > On 9 Sep 2013, at 21:03, Alvaro Herrera 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*

Re: [GENERAL] Making substrings uppercase

2013-09-10 Thread Oliver Kohll - Mailing Lists
On 9 Sep 2013, at 21:03, Alvaro Herrera 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

Re: [GENERAL] Making substrings uppercase

2013-09-09 Thread Alvaro Herrera
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 upp

Re: [GENERAL] Making substrings uppercase

2013-09-09 Thread Oliver Kohll - Mailing Lists
On 9 Sep 2013, at 14:41, David Johnston wrote: > Oliver Kohll - Mailing Lists wrote >> select regexp_replace(sentence,'\*(.*?)\*','' || upper('\1'),'g') from >> sentences; > > Yeah, you cannot embed a function-call result in the "replace with" section; > it has to be a literal (with the group i

Re: [GENERAL] Making substrings uppercase

2013-09-09 Thread David Johnston
Oliver Kohll - Mailing Lists wrote > select regexp_replace(sentence,'\*(.*?)\*','' || upper('\1'),'g') from > sentences; Yeah, you cannot embed a function-call result in the "replace with" section; it has to be a literal (with the group insertion meta-sequences allowed of course). I see two possi

[GENERAL] Making substrings uppercase

2013-09-09 Thread Oliver Kohll - Mailing Lists
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. The QUICK BROWN fox jumped over the LAZY dog Given text in a column sentence in table sentences, I