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

Поиск
Список
Период
Сортировка
От Peter J. Holzer
Тема Re: Regular expression to UPPER() a lower case string
Дата
Msg-id 20221211134412.gim5u5rzxopcojn3@hjp.at
обсуждение исходный текст
Ответ на Re: Regular expression to UPPER() a lower case string  ("Peter J. Holzer" <hjp-pgsql@hjp.at>)
Список pgsql-general
On 2022-12-10 15:48:58 +0100, Peter J. Holzer wrote:
> On second thought you could probably use NFD normalization to separate
> base letters from accents, uppercase the base letters and then
> (optionally) NFC normalize everything again.

Of course I had to try that:

wds=> select
    normalize(
        replace(
            replace(
                replace(
                    replace(
                        normalize('Käse', NFD),
                        's', 'S'
                    ),
                    'k', 'K'
                ),
                'e', 'E'
            ),
            'a', 'A'
        ),
    NFC
    )
;
╔═══════════╗
║ normalize ║
╟───────────╢
║ KÄSE      ║
╚═══════════╝
(1 row)

Works as expected.

> Still insane ;-).

I haven't changed my mind about that.

        hp


--
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp@hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

Вложения

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

Предыдущее
От: Alban Hertroys
Дата:
Сообщение: Re: Regular expression for lower case to upper case.
Следующее
От: Adrien Nayrat
Дата:
Сообщение: PITR and instance without any activity