How to clean up phone-numbers with regex?

From: Andreas <maps(dot)on(at)gmx(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: How to clean up phone-numbers with regex?
Date: 2014-05-19 08:54:25
Message-ID: 5379C6C1.5020904@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi

I need to clean up phone-numbers. Somehow I got a Excel list that has
weird graphical characters trailing some of the entries.
My DB is UTF8 so it would store this mess but I don't like to import it
in the first place.

OK, I know how to read the stuff into a temporary table to clean it up
before the actual import.
How can I do an update on the column that deletes every char that is not
in a given set of chars like '+- 0123456/()'?

Second but similar question:
How can I select records that have fields that contain characters not
included in a given alphabet?
E.G. find fields that contain some char not in 0-9,a-z,A-Z, +-()/?

regards
Andreas

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Rob Sargent 2014-05-19 13:39:58 Re: How to clean up phone-numbers with regex?
Previous Message James Cloos 2014-05-19 05:43:33 Re: matching column of regexps