From: | Eagna <eagna(at)protonmail(dot)com> |
---|---|
To: | "Peter J(dot) Holzer" <hjp-pgsql(at)hjp(dot)at> |
Cc: | Gianni Ceccarelli <dakkar(at)thenautilus(dot)net>, pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: Regular expression to UPPER() a lower case string |
Date: | 2022-12-10 15:37:01 |
Message-ID: | fgSp5K7HkX69er-G42suxcBE5nMS-AWqj3TtGKyF7Tgof4dlO0Q6YWDJScuagN2G2mJXydpYmTwWPpxpdMEWmkoQ1hTUaDVEyDEsW7SPgsQ=@protonmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi, and thanks for all of the input - I think I'm beginning to grok it.
> 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. Still insane ;-).
As far as I can see, I can only do what I want by using the following.
If there's a monthly prize on this list for the most insanely contrived piece of code, I think this is a strong contender:
test.x = 'abc'
SELECT
UPPER(REGEXP_REPLACE(x, '(.)(.)(.)', '\1')) ||
UPPER(REGEXP_REPLACE(x, '(.)(.)(.)', '\2')) ||
UPPER(REGEXP_REPLACE(x, '(.)(.)(.)', '\3'))
FROM test;
Result: ABC
(see https://dbfiddle.uk/LQ-6udga)
Still a bit of work to do, but I'm getting there :-)
E.
> hp
From | Date | Subject | |
---|---|---|---|
Next Message | Peter J. Holzer | 2022-12-10 16:16:06 | Re: Regular expression to UPPER() a lower case string |
Previous Message | Gianni Ceccarelli | 2022-12-10 15:26:25 | Re: Regular expression to UPPER() a lower case string |