Re: Funtion to clean up strings? - Mailing list pgsql-sql

From Andreas
Subject Re: Funtion to clean up strings?
Date
Msg-id 4994BBBA.3000302@gmx.net
Whole thread Raw
In response to Funtion to clean up strings?  (Andreas <maps.on@gmx.net>)
Responses Re: Funtion to clean up strings?  (Raj Mathur <raju@linux-delhi.org>)
List pgsql-sql
Wow, that was fast
THANKS   :)

now ... lets get more complicated.
Phone numbers are entered:
0123/4567-89          national number
0049/123/4567-89         the same number
+49/123/4567-89         still the same number

should come out as   0123456789  to search in this column.
"0049" and "+49"  --> 0

while international numbers
+33/123456789
0033/123456789

should come as
+33123456789

I fear the hard part is that international codes have 1-3 digits   :(


Regards
Andreas


ivan Stoykov wrote:
> regexp_replace('120323423 23(fdf_)fd','[^[:digit:]]','','gi')
>
> Andreas wrote:
>   
>> Hi,
>>
>> I need a function that removes characters in strings that aren't in a
>> given set of chars.
>> e.g
>> Input:    12-34/ 56(8)
>> I want just numbers so Output should in this case be:  1234568
>>
>> Is there a solution?


pgsql-sql by date:

Previous
From: "Dickson S. Guedes"
Date:
Subject: Re: Funtion to clean up strings?
Next
From: Raj Mathur
Date:
Subject: Re: Funtion to clean up strings?