Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p4Jln-0004m5-Tn for pgsql-general@arkaria.postgresql.org; Sun, 11 Dec 2022 10:41:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p4Jll-0002Ue-6Y for pgsql-general@arkaria.postgresql.org; Sun, 11 Dec 2022 10:41:17 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p4Jlk-0002UU-Qo for pgsql-general@lists.postgresql.org; Sun, 11 Dec 2022 10:41:16 +0000 Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1p4Jli-0000wg-FN for pgsql-general@lists.postgresql.org; Sun, 11 Dec 2022 10:41:15 +0000 Received: by mail-ej1-x62e.google.com with SMTP id bj12so21289033ejb.13 for ; Sun, 11 Dec 2022 02:41:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=/cLhB5KzaDMAyp5SngN3eYdi7DaO4UlaVH/TRnd0q04=; b=aZ1kJdXRHjlnlHa+YUowhUeaG0SBKexC6KS3PfkQvTgqwCFuSgHiYHvBF5NY5jAXyK QChQviYemTEhj3rsrpNa6ihnhA4+Hnyzqji2VAz0KpsjTBP5vAy5Gz2++FNUPSfVL34w oH5dmMGMPh2yh2PiMQ4j1NEcPXBOJPMN8P+aiMdlXBcfDolw1AJEznWxbLl4WQxUg0Mm MVAM/rQ7i3QmKmYlMoE+JQz7I9tcuWnW4dJ2v8137q12KuK+hrrg9JtCq1vIUaTfvO4m BlHSoIIDKKdI4fYdOa7jcwAS2Am18WeGCvetfM2utgVzohUV6Ey3PYjwVxGw9AEiJV9E tEcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/cLhB5KzaDMAyp5SngN3eYdi7DaO4UlaVH/TRnd0q04=; b=qENc17m2rhb5hMKocbYROsH/2GR2dZ+B/p2VFd7gfsFnOuAxXD2cA0mK5OaCbttGmw GcvA+su0S4WwgQEyxr+J1QlomDHwWj5YDyyiVSv+4XNW3N/FOUHmJKxeGXWqsNG/wW2K ZZ9BfjOnqaUVZqRE9d1onu1YENW2qtjadXzgZI86uxZzVx7tTEb0VklE4UdlyUmyWvuO RgrciDVcXIdXuN9+8R+LcVZbpebgszHtgcCaFaZxb0FOYUcBrzYXwtYDKuzW8tiWW9wZ 32fJVIlMVW1fB+HSSUIAMDz3+jZfUo+wNqIS9BjLJxVlQw7ujYYOPO+ey1bA9oaAOVzF T57A== X-Gm-Message-State: ANoB5pksWkODx+yK+shdvx+X7SogxIliQOqrqmer+gQXkziZq1Ce0nw1 0heFojvlX1nawrrKqlpqJAw= X-Google-Smtp-Source: AA0mqf4qfiCtemz7eu5cP8G2Khmq4FJBWC5Z2k4aIAt+Pe5Rpndp7+3cjrYsWcMVOdKdJrkJEWZfbw== X-Received: by 2002:a17:907:8a22:b0:78d:f455:b4d8 with SMTP id sc34-20020a1709078a2200b0078df455b4d8mr12222076ejc.63.1670755273464; Sun, 11 Dec 2022 02:41:13 -0800 (PST) Received: from hollewijn.internal (217-19-30-105.dsl.cambrium.nl. [217.19.30.105]) by smtp.gmail.com with ESMTPSA id h1-20020a50ed81000000b00458dc7e8ecasm2611704edr.72.2022.12.11.02.41.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Dec 2022 02:41:12 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) Subject: Re: Regular expression for lower case to upper case. From: Alban Hertroys In-Reply-To: <7EOY6xZE-t6VXu6ozkVJYGeHODc3-_PBubDAGaSXRP_JznkELzYdQJriJsWaIS2nTJ0Esyh0htfsdfEIUrnUUHh--58QQwTpo5y6wQKzrfU=@protonmail.com> Date: Sun, 11 Dec 2022 11:41:06 +0100 Cc: "David G. Johnston" , "pgsql-general@lists.postgresql.org" Content-Transfer-Encoding: quoted-printable Message-Id: <5C6EE9B5-477D-4206-8C36-D083CE54BED4@gmail.com> References: <7EOY6xZE-t6VXu6ozkVJYGeHODc3-_PBubDAGaSXRP_JznkELzYdQJriJsWaIS2nTJ0Esyh0htfsdfEIUrnUUHh--58QQwTpo5y6wQKzrfU=@protonmail.com> To: Eagna X-Mailer: Apple Mail (2.3608.120.23.2.7) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 10 Dec 2022, at 12:00, Eagna wrote: >=20 >=20 > Hi, and thanks for your input. >=20 >=20 >> RegExp by itself cannot do this. You have to match all parts of the = input into different capturing groups, then use lower() combined with = format() to build a new string. Putting the capturing groups into an = array is the most useful option. >=20 >=20 > OK - I *_kind_* of see what you're saying.=20 >=20 > There's a small fiddle here (https://dbfiddle.uk/rhw1AdBY) if you'd = care to give an outline of the solution that you propose. If you put all the regexes and their replacements into a table[1], you = could use an aggregate over them to combine all the replacements into = the final string. It would need some aggregate like regex_replace_agg, = which would probably be a custom aggregate. [1]: If you stick to ASCII, you could just calculate them and even omit = storing them in a physical table. Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you'll find there is no forest.