Search Postgresql Archives

Re: Can Postgres beat Oracle for regexp_count?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, Tom, Lane,

On Wed, 2 Feb 2022 at 22:26, Tom Lane <tgl@xxxxxxxxxxxxx> wrote:
"David G. Johnston" <david.g.johnston@xxxxxxxxx> 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

=# 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.)

Can the whole 3 or 4 or 5 to be matched as 1?

The following has been attempted but no luck.

select regexp_matches('My High Street', '([A-Z][a-z]+[\s]*)+', 'g')
It is intended to match 'My High Street, but it turned out only 'Street' was matched. 

Regards,  David 

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux