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

From: Shaozhong SHI <shishaozhong(at)gmail(dot)com>
To: Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>
Cc: pgsql-general <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 17:07:27
Message-ID: CA+i5Jwb0A=_Uh+CbAm9qeXC5otc1fWWEUsPqA8Ci4cng3qTgdw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi, Karsten,

That sounds interesting.

Any good example?

Regards, David

On Wed, 8 Dec 2021 at 12:10, Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>
wrote:

> 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 Vincent Veyron 2021-12-08 17:40:58 Re: How to allow null as an option when using regexp_matches?
Previous Message Oskar Stenberg 2021-12-08 14:18:36 RE: Working with fixed-point calculations in C