RE: Match against a column of regexes?

Поиск
Список
Период
Сортировка
От Stephen Froehlich
Тема RE: Match against a column of regexes?
Дата
Msg-id BL0PR06MB4882B3762B1482B4CE450322E56B0@BL0PR06MB4882.namprd06.prod.outlook.com
обсуждение исходный текст
Ответ на Re: Match against a column of regexes?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-novice
Actually, all I needed to do was to reverse the input text and the column name in the query:

    SELECT DISTINCT group_id FROM logins WHERE '[user_email]' ~* email_regex;

--Stephen

-----Original Message-----
From: Tom Lane <tgl@sss.pgh.pa.us>
Sent: Friday, October 18, 2019 1:27 AM
To: Stephen Froehlich <s.froehlich@cablelabs.com>
Cc: pgsql-novice@lists.postgresql.org
Subject: Re: Match against a column of regexes?

Stephen Froehlich <s.froehlich@cablelabs.com> writes:
> I was wondering if there was an elegant way to match a given string against a column of regexes within PostgreSQL?
I'monly 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



В списке pgsql-novice по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Match against a column of regexes?
Следующее
От: Irene Yeh
Дата:
Сообщение: Adding primary key on table with 3 billion records.