Re: How to allow null as an option when using regexp_matches? - Mailing list pgsql-general

From Karsten Hilbert
Subject Re: How to allow null as an option when using regexp_matches?
Date
Msg-id YbCgkqv/TTG04J0T@hermes.hilbert.loc
Whole thread Raw
In response to How to allow null as an option when using regexp_matches?  (Shaozhong SHI <shishaozhong@gmail.com>)
Responses Re: How to allow null as an option when using regexp_matches?  (Shaozhong SHI <shishaozhong@gmail.com>)
List pgsql-general
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
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B



pgsql-general by date:

Previous
From: Shaozhong SHI
Date:
Subject: How to allow null as an option when using regexp_matches?
Next
From: "Zwettler Markus (OIZ)"
Date:
Subject: AW: error connecting to pgbouncer admin console