Re: How to allow null as an option when using regexp_matches?

From: Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: How to allow null as an option when using regexp_matches?
Date: 2021-12-08 12:09:54
Message-ID: YbCgkqv/TTG04J0T@hermes.hilbert.loc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Zwettler Markus (OIZ) 2021-12-08 13:59:54 AW: error connecting to pgbouncer admin console
Previous Message Shaozhong SHI 2021-12-08 12:07:13 How to allow null as an option when using regexp_matches?