pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter J. Holzer <hjp-pgsql@hjp.at>
To: pgsql-general@lists.postgresql.org
Subject: Re: Regular expression for lower case to upper case.
Date: Sat, 10 Dec 2022 11:25:06 +0100
Message-ID: <20221210102506.bg3ogthnrzislep4@hjp.at> (raw)
In-Reply-To: <yk4Ucm1Andim5urGdLDSwhTdytxgXWvHVd1PgUZht80zfEiK3Eo-Qz3YKFMI2D2cwhoLcNxY8mNoWbW_Plz65T6YdQpPSll1hPckh7WYeSA=@protonmail.com>
References: <yk4Ucm1Andim5urGdLDSwhTdytxgXWvHVd1PgUZht80zfEiK3Eo-Qz3YKFMI2D2cwhoLcNxY8mNoWbW_Plz65T6YdQpPSll1hPckh7WYeSA=@protonmail.com>

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!"

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (8+ messages)  latest in thread

Message-ID: <20221210102506.bg3ogthnrzislep4@hjp.at>
Permalink:  ../20221210102506.bg3ogthnrzislep4@hjp.at/
Also on:    postgresql.org/message-id/20221210102506.bg3ogthnrzislep4@hjp.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: hjp-pgsql@hjp.at
  Subject: Re: Regular expression for lower case to upper case.
  In-Reply-To: <20221210102506.bg3ogthnrzislep4@hjp.at>
  References: <yk4Ucm1Andim5urGdLDSwhTdytxgXWvHVd1PgUZht80zfEiK3Eo-Qz3YKFMI2D2cwhoLcNxY8mNoWbW_Plz65T6YdQpPSll1hPckh7WYeSA=@protonmail.com> <20221210102506.bg3ogthnrzislep4@hjp.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox