Search Postgresql Archives

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

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

 



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







[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