Re: Regular expression to UPPER() a lower case string

Поиск
Список
Период
Сортировка
От Gianni Ceccarelli
Тема Re: Regular expression to UPPER() a lower case string
Дата
Msg-id 20221210134740.2dbf966e@nautilus
обсуждение исходный текст
Ответ на Re: Regular expression to UPPER() a lower case string  (Eagna <eagna@protonmail.com>)
Ответы Re: Regular expression to UPPER() a lower case string  (Eagna <eagna@protonmail.com>)
Список pgsql-general
On 2022-12-10 Eagna <eagna@protonmail.com> wrote:
> Hi again, and thanks for sticking with this.
> > You haven't explained what you're trying to accomplish.  
> 
> Ok.
> 
> CREATE TABLE test(x TEXT); 
> 
> INSERT INTO test VALUES ('abc');
> 
> SELECT   REGEXP_REPLACE(x, '<something>', '<something_else>', 'g')
> FROM test;
> 
> Expected result: ABC

`select upper(x) from test`

You haven't explained why you need regexes at all. If you want to
convert the value of a text column to uppercase, there's a function
for that.

If you want to do something else, please describe the actual thing you
want to do. Not "how", but "what".

> David Johnston suggested something along these lines:
> 
> ==========
> > RegExp by itself cannot do this. You have to match all parts of the
> > input into different capturing groups, then use lower() combined
> > with format() to build a new string. Putting the capturing groups
> > into an array is the most useful option.  
> ===========
> 
> But it's a bit above my pay grade to do this - I've tried, but no go!
> :-( It *_appears_* to me that the string's length would have to be
> hard coded under this strategy - but if that's the only way, then so
> be it.

Maybe you need to look at `regexp_split_to_array` or
`regexp_split_to_table`?

-- 
    Dakkar - <Mobilis in mobile>
    GPG public key fingerprint = A071 E618 DD2C 5901 9574
                                 6FE2 40EA 9883 7519 3F88
                        key id = 0x75193F88




В списке pgsql-general по дате отправления:

Предыдущее
От: Gianni Ceccarelli
Дата:
Сообщение: Re: Regular expression to UPPER() a lower case string
Следующее
От: "Peter J. Holzer"
Дата:
Сообщение: Re: Regular expression to UPPER() a lower case string