Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

Attachment: signature.asc
Description: PGP signature


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux