Re: Match against a column of regexes?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephen Froehlich <s(dot)froehlich(at)cablelabs(dot)com>
Cc: "pgsql-novice(at)lists(dot)postgresql(dot)org" <pgsql-novice(at)lists(dot)postgresql(dot)org>
Subject: Re: Match against a column of regexes?
Date: 2019-10-18 07:26:57
Message-ID: 27739.1571383617@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Stephen Froehlich <s(dot)froehlich(at)cablelabs(dot)com> writes:
> I was wondering if there was an elegant way to match a given string against a column of regexes within PostgreSQL? I'm only working with a few tens of lines, so I can read them all into R and examine them 1-by-1, but I thought I would ask.

Something like

... WHERE mystring ~ ANY (SELECT regex FROM regexes)

should do.

regards, tom lane

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Stephen Froehlich 2019-10-23 16:37:58 RE: Match against a column of regexes?
Previous Message Stephen Froehlich 2019-10-17 21:03:08 Match against a column of regexes?