Re: Reverse pattern match. - Mailing list pgsql-sql

From Rod Taylor
Subject Re: Reverse pattern match.
Date
Msg-id 1061247934.33964.1.camel@jester
Whole thread Raw
In response to Reverse pattern match.  ("Moonstruck" <bogus.email@pls-relpy-to.group>)
List pgsql-sql
On Mon, 2003-08-18 at 03:05, Moonstruck wrote:
> I want to create a table of  regular expression patterns (for assessing
> phone numbers), something like:
> CREATE TABLE CallType ( pattern varchar primary key,
>                         type    varchar,
>                         rate    int4);
> INSERT INTO CallType VALUES ('0[3-9]________','Interstate Call',50);
> INSERT INTO CallType VALUES ('9_______','Local Call',25);
> INSERT INTO CallType VALUES ('0011__________%','International Call',100);
>
> Then determine call types, based on a match, something like:
>
>
> PhoneNumber := '99116633';
> SELECT type, rate FROM CallType where pattern LIKE PhoneNumber;

SELECT type, rate FROM CallType WHERE PhoneNumber ~ pattern;


pgsql-sql by date:

Previous
From: "Moonstruck"
Date:
Subject: Reverse pattern match.
Next
From: Josh Berkus
Date:
Subject: Re: Reverse pattern match.