regular expression searches

From: "David Bitner" <bitner(at)macnoise(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: regular expression searches
Date: 2004-10-07 21:07:08
Message-ID: JLEBJEFBOADDHAIFJNPEEELJCCAA.bitner@macnoise.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I am trying to create a PL/PGSQL function that can parse a street address
into the component parts (i.e. "200 W 54th Street" into num->200 dir->W
street->54th type->ST).

What I would like is to be able to use regular expressions within PL/PGSQL
to accomplish this using mapping tables for the different components.

For example, I would have a table with all the different acceptible road
types:
Abbreviation | Regex
__________________________________
RD | R(OA)?D
AV | AVE?(NUE)?
ST | STR?(EET)?

and replace everything that matches the regex with the abbreviation while
saving the road type as a variable.

Any help would be appreciated.

Thanks,
David

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Net Virtual Mailing Lists 2004-10-07 21:52:00 Index problem.... GIST (tsearch2)
Previous Message Tom Lane 2004-10-07 20:43:53 Re: DDL triggers [was Re: database constraints]