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

2022-12-11 Thread Peter J. Holzer
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(

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

2022-12-10 Thread Peter J. Holzer
On 2022-12-10 15:37:01 +, Eagna wrote: > Hi, and thanks for all of the input - I think I'm beginning to grok it. I'm not so sure about that > 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 p

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

2022-12-10 Thread Eagna
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,

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

2022-12-10 Thread Gianni Ceccarelli
On 2022-12-10 "Peter J. Holzer" wrote: > So, what's the point you are trying to make? I suspect I mis-understood a thing you wrote… ignore me. > > Of course all of this is dependent of locale, too. > Right. But why would that be different for regexp_replace than for > upper/lower? I was tryin

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

2022-12-10 Thread Peter J. Holzer
On 2022-12-10 14:36:04 +, Eagna wrote: > > I want to index on a REGEXP_REPLACE() - I thought using lower -> upper > > would be a good test. > > > I could always have used another REGEXP_REPLACE() for my testing, > > but I then became "obsessed" with the idea of using > > REGEXP_REPLACE() as

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

2022-12-10 Thread Eagna
> `select upper(x) from test` I know about the UPPER() and LOWER() functions - I don't want them! > If you want to do something else, please describe the actual thing you > want to do. Not "how", but "what". I have described it - I want to do the *_same_* thing as UPPER() does using REGEXP_

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

2022-12-10 Thread Peter J. Holzer
On 2022-12-10 13:44:37 +, Gianni Ceccarelli wrote: > On 2022-12-10 "Peter J. Holzer" wrote: > > > * your logic only works by accident for some languages (try to > > > upcase a `ß` or a `ı`) > > > > This is also true of upper() and lower() and SQL does provide those. > > Well… > > > select

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

2022-12-10 Thread Gianni Ceccarelli
On 2022-12-10 Eagna 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, '', '', 'g') > FROM test; > > Expected result: AB

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

2022-12-10 Thread Gianni Ceccarelli
On 2022-12-10 "Peter J. Holzer" wrote: > > * your logic only works by accident for some languages (try to > > upcase a `ß` or a `ı`) > > This is also true of upper() and lower() and SQL does provide those. Well… > select upper('ı'); ┌───┐ │ upper │ ├───┤ │ I │ └───┘ (1 row) >

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

2022-12-10 Thread Eagna
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, '', '', 'g') FROM test; Expected result: ABC See fiddle here: https://dbfiddle.uk/Q2qXXwtF D

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

2022-12-10 Thread Peter J. Holzer
On 2022-12-10 10:41:41 +, Gianni Ceccarelli wrote: > On 2022-12-10 Eagna wrote: > > This should be very (very) easy - I don't know what I'm missing - > > I've done quite complex regular expressions before and I don't know > > what I'm doing wrong. Brain burping this morning! > > You're missin

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

2022-12-10 Thread Gianni Ceccarelli
On 2022-12-10 Eagna wrote: > If you have any ideas how it could be done indirectly/different > strategy - I'm all ears. You haven't explained what you're trying to accomplish. -- Dakkar - GPG public key fingerprint = A071 E618 DD2C 5901 9574

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

2022-12-10 Thread Eagna
Ciao and thanks for your input. > * `regexp_replace` doesn't work like that, at all > * your logic only works by accident for some languages (try to upcase > a `ß` or a `ı`) If you have any ideas how it could be done indirectly/different strategy - I'm all ears. You can assume all English c

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

2022-12-10 Thread Gianni Ceccarelli
On 2022-12-10 Eagna wrote: > This should be very (very) easy - I don't know what I'm missing - > I've done quite complex regular expressions before and I don't know > what I'm doing wrong. Brain burping this morning! You're missing that: * `regexp_replace` doesn't work like that, at all * your l

Regular expression to UPPER() a lower case string

2022-12-10 Thread Eagna
Hi all, as per the subject, I want a regular expression to do what the UPPER() function does. Obviously, I know about that function and it is not what I want. This should be very (very) easy - I don't know what I'm missing - I've done quite complex regular expressions before and I don't know w