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: (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
Wow, that was fast

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

should come as

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


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


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-2017 The PostgreSQL Global Development Group