Re: test against regexp in database

From: Frank Bax <fbax(at)sympatico(dot)ca>
To: holger(at)marzen(dot)de, pgsql-general(at)postgresql(dot)org
Subject: Re: test against regexp in database
Date: 2002-11-24 13:13:36
Message-ID: 5.1.1.6.0.20021124080604.036fc880@pop6.sympatico.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

At 07:23 AM 11/24/02, Holger Marzen wrote:
>Hi boys and girls,
>
>as we all know, PostgreSQL can do selects on regexps. But I'd like to
>store regexps in a table with the columns "from" and "to". The "from"
>column should contain email sender adresses, and the "to" column should
>contain faxnumbers the user is allowed to send faxes to (mail to fax
>gateway). I'd like to uses regexps as well in the "to" column, say
>
>from to
>------ ---------
>holger(at)home(dot)de .*
>you(at)aol(dot)com ^0123.*
>
>and test against this. Of yourse I can do a select with "from=userid"
>and then pipe the result through some commands that do the regexp check.
>but is there a more elegant way to do this, maybe in a single select?

Works for me:
where from = userid and fax ~ to;

Frank

Browse pgsql-general by date

  From Date Subject
Next Message CN 2002-11-24 13:20:18 Firing Order For Referential Integrity Delete
Previous Message Holger Marzen 2002-11-24 12:23:54 test against regexp in database