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 1nFO5C-0005wH-SC for pgsql-general@arkaria.postgresql.org; Wed, 02 Feb 2022 22:26:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nFO5A-0005nR-Ec for pgsql-general@arkaria.postgresql.org; Wed, 02 Feb 2022 22:26:32 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nFO5A-0005nI-4N for pgsql-general@lists.postgresql.org; Wed, 02 Feb 2022 22:26:32 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nFO53-0006yY-L1 for pgsql-general@lists.postgresql.org; Wed, 02 Feb 2022 22:26:31 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 212MQMfw104524; Wed, 2 Feb 2022 17:26:22 -0500 From: Tom Lane To: "David G. Johnston" cc: Shaozhong SHI , pgsql-general Subject: Re: Can Postgres beat Oracle for regexp_count? In-reply-to: References: Comments: In-reply-to "David G. Johnston" message dated "Wed, 02 Feb 2022 13:43:15 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <104522.1643840782.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Feb 2022 17:26:22 -0500 Message-ID: <104523.1643840782@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "David G. Johnston" writes: > Given we don't have a regexp_count function this isn't surprising... FYI, it's there in HEAD. In the meantime, you could possibly do something like =3D# select count(*) from regexp_matches('My High Street', '([A-Z][a-z]+[\= s])', 'g'); count = ------- 2 (1 row) (Note that 2 is the correct answer given that there's no space after the third word; I trust Oracle agrees.) regards, tom lane