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 1muvlo-0001aV-GW for pgsql-general@arkaria.postgresql.org; Wed, 08 Dec 2021 12:10:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1muvln-0000M5-C9 for pgsql-general@arkaria.postgresql.org; Wed, 08 Dec 2021 12:09:59 +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 1muvln-0000Lw-1C for pgsql-general@lists.postgresql.org; Wed, 08 Dec 2021 12:09:59 +0000 Received: from mout.gmx.net ([212.227.15.18]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1muvll-0002GR-0Z for pgsql-general@lists.postgresql.org; Wed, 08 Dec 2021 12:09:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1638965396; bh=8WxypQEpuT76BIh+vHJp5944EZZ6DG39D0UEnDCTQ1E=; h=X-UI-Sender-Class:Date:From:To:Subject:References:In-Reply-To; b=AKePQpizu8mazyxnIagpEylGOGCNkgG/K9D43iGWQBcJ+TgHiC9AqTRFvgh0KuHM/ P43DazgBNx87IUmUqdwftFFpqbX8BWFkHqmIT/yrXy1r17KyOEpomuKY/8ZeapQln0 qj8TL+5+E8jBnS3txWicq2v0WcIZ0vURN94ip/uo= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from hermes ([84.144.192.242]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MXXuH-1n3WVI2FDj-00YxtW for ; Wed, 08 Dec 2021 13:09:55 +0100 Received: from ncq by hermes with local (Exim 4.94.2) (envelope-from ) id 1muvli-0005sf-F2 for pgsql-general@lists.postgresql.org; Wed, 08 Dec 2021 13:09:54 +0100 Date: Wed, 8 Dec 2021 13:09:54 +0100 From: Karsten Hilbert To: pgsql-general@lists.postgresql.org Subject: Re: How to allow null as an option when using regexp_matches? Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Ma_X_il-Followup-to: d Re_X_turn-receipt-to: Karsten.Hilbert@gmx.net Di_X_sposition-Notification-To: Karsten.Hilbert@gmx.net X-Confi_X_rm-Reading-To: Karsten.Hilbert@gmx.net X-Pri_X_ority: 2 (High) Sender: X-Provags-ID: V03:K1:OZXO98QNBbSPXx9yrxH6ArO3Ptrwezjvp1h8pLZso5sThoge2hB UEDPBNf0ssa/8YMJMTIgat3H/WyFMaxxurb9uYPHaHMS25KaJGK+EMlNf+ynWsPU1QsFjMi Mc0A31ty3ZITxjCNFZvP13qaBrwO7FRoDLFLf2HVrOi+bMPT5PApeBkf4UY7xKnw3JOWv5W 4PrVZBopSLGbPcQ0J3SXw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:uwpt/1NBtxs=:GXPoY8BPLjqtExXG4EP9p6 dR9ysBytMd1Rt10HdHBZY3CeDSXEOOtpmMwWZezreFb3uinm/IFD3Ovqu0cjfD6P+GpCksg2D trNHZqER1K0v0YG0lz80hijCsU1yAd75xEo6MMEnu6mHpZ2nSWX9oI+EbuvyFA73UbVs4ajdO 1Tuoq3xMOgIzLwhF/JrgUgRRvIVfkcXpLUF/fIi6GVcXZzhzkdJWLUrUyISXN0pLeV7X2nQE0 H3qL5rQrTmHuv6upZN68GGcUjirGDRlG/VQQ67UbWvvldjUYVmJEDkT4+q/jhCHUjeoqrWMN5 ACH6ySorrXFux7t/nb336jTF7txFGhzay7xl675oDrn/EisZowSjv1MVoaFfTBKo/lTBnRrqB rtjxwuYXbOQXGjwrQSC+TW7iCvbmyyAu3EB4lS9kz6LVM9BtGwxYp62LFC9+nCtemfEvafa+o Xk7Pz8nTcY8nWSVGy6giiyCIQgsFry6BGaia1ekLT4jj5vRuOIKCbggrHe86O9NP8m4ZKbRA0 5b3oevj7kxoogqe1pJ7ZS2wSFD8+3mDxLYs6r9i18iORHr5S/9DaJmLoshsptMqqIjnd1w3Z8 xayhdy6JwMtJjgN5e5yYqn0Nlycp84oPZt151hurj6L6D/yHYK7cXg/CCfjRcgA11ZlHe2sPx tuQDLTYIehDirphsGz3ZhB/l4z+CwWqNXy4dLWwh3cvLVvkkv+gs0i2CJ0Q8CA0Ko2dmYWKfB VB5M37VcHDbLp3pCqgsyrtjzB8f6cy0PEpDmNFsYcHaWTJNKLJ6XRHavAsCn/q/i8oGrmXz2R AieoEM54oLP6A9lL4TvGaIEdNz8RsGmxx8NtLvQfuaxckXTHvRw6TPDgjMpVIS28FlIyMjcmQ EDYShFJODQLxyi+aq2bmGGbYxGwGuVAzlLB5DcqU6mM3208ds8kwwtF5kjukmMToxDW/4yzme tz9kWNbzJbvq5H+JJRHwXS2qAPMFje7HAXqXfNb/ByCJkxFJD6guc/AVxF0b6j1oZetUCmkX8 NvBQDFqKT9r9Puf5DzvZgNax+525PQzPb2+/n0G2u1Yh4IWV66L/ojDU+4AqXPE3tHxigG3ir RkPorUz0cE/6Aw= Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Am Wed, Dec 08, 2021 at 12:07:13PM +0000 schrieb Shaozhong SHI: > We can do this: > select count(*) from regexp_matches('Great London', 'Great > London|Information Centre|Department for Transport', 'g'); > > Is it possible to allow null as an option? something like this > select count(*) from regexp_matches('Great London', 'null|Great > London|Information Centre|Department for Transport', 'g'); You seem to want to apply coalesce() judiciously. Best, Karsten =2D- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B