Re: Regular expression for lower case to upper case. - Mailing list pgsql-general

From Peter J. Holzer
Subject Re: Regular expression for lower case to upper case.
Date
Msg-id 20221210102506.bg3ogthnrzislep4@hjp.at
Whole thread Raw
In response to Regular expression for lower case to upper case.  (Eagna <eagna@protonmail.com>)
Responses Re: Regular expression for lower case to upper case.  (Eagna <eagna@protonmail.com>)
List pgsql-general
On 2022-12-10 09:40:22 +0000, Eagna wrote:
> I want a regex to change the case of a field from UPPER to lower.

First a note about terminology: A regular expression matches a string,
it doesn't replace anything.

The regexp_replace function uses a regular expression to match parts of
a string and then uses to replacement string to replace them - but the
replacement string is not itself a regular expresssion.

Tha said, the replacement string in some editors (like Vim) and some
programming languages (like Perl) provides syntax for changing case
(both vi(m) and Perl use \u and \U...\E for uppercasing).

https://www.postgresql.org/docs/current/functions-matching.html#FUNCTIONS-POSIX-REGEXP
doesn't mention any special escapes except \1 through \9 and \&. So it
is extremely likely that no such escapes exist.


> I know about the UPPER() and LOWER() functions and they are not what I want.

Can you elaborate why you can't use those?

        hp

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

Attachment

pgsql-general by date:

Previous
From: Eagna
Date:
Subject: Regular expression for lower case to upper case.
Next
From: "David G. Johnston"
Date:
Subject: Re: Regular expression for lower case to upper case.