Thread: Is there a way to remove every character but numbers?

Is there a way to remove every character but numbers?

From
Andreas
Date:
Hi,

I need to clean up a text column so that it just contains numbers or the 
"+" sign if it is the first character of the string.

Well, it is needed to normalise up a phone number column.
So it'd be great if the "+" could be transformed in "00" in the same step.


Re: Is there a way to remove every character but numbers?

From
Viktor Bojović
Date:
<br /><br /><div class="gmail_quote">On Sun, Feb 5, 2012 at 2:47 PM, Andreas <span dir="ltr"><<a
href="mailto:maps.on@gmx.net">maps.on@gmx.net</a>></span>wrote:<br /><blockquote class="gmail_quote"
style="border-left:1pxsolid rgb(204,204,204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex"> Hi,<br /><br /> I need to
cleanup a text column so that it just contains numbers or the "+" sign if it is the first character of the string.<br
/><br/> Well, it is needed to normalise up a phone number column.<br /> So it'd be great if the "+" could be
transformedin "00" in the same step.<br /><font color="#888888"><br /> -- <br /> Sent via pgsql-sql mailing list (<a
href="mailto:pgsql-sql@postgresql.org"target="_blank">pgsql-sql@postgresql.org</a>)<br /> To make changes to your
subscription:<br/><a href="http://www.postgresql.org/mailpref/pgsql-sql"
target="_blank">http://www.postgresql.org/<u></u>mailpref/pgsql-sql</a><br/></font></blockquote></div><br />try
regexp_replace<br/><br clear="all" /><br />-- <br />---------------------------------------<br />Viktor Bojović<br
/>---------------------------------------<br/>Wherever I go, Murphy goes with me<br />