Skip site navigation (1) Skip section navigation (2)

Re: Funtion to clean up strings?

From: Andreas <maps(dot)on(at)gmx(dot)net>
To: ivan(dot)stoykov(at)voicecom(dot)bg
Cc: pgsql-sql(at)postgresql(dot)org, listas(at)guedesoft(dot)net
Subject: Re: Funtion to clean up strings?
Date: 2009-02-13 00:15:54
Message-ID: 4994BBBA.3000302@gmx.net (view raw or flat)
Thread:
Lists: 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?

In response to

Responses

pgsql-sql by date

Next:From: Raj MathurDate: 2009-02-13 04:27:42
Subject: Re: Funtion to clean up strings?
Previous:From: Dickson S. GuedesDate: 2009-02-13 00:00:46
Subject: Re: Funtion to clean up strings?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group