[SQL] Funtion to clean up strings?

2009-02-12 Thread Andreas
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? -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your s

Re: [SQL] Funtion to clean up strings?

2009-02-12 Thread Dickson S. Guedes
2009/2/12 Andreas : > 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? One is: SELECT regexp_replace('12-34/ 56(8)',E'[^0-9]'

Re: [SQL] Funtion to clean up strings?

2009-02-12 Thread Andreas
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" -

Re: [SQL] Funtion to clean up strings?

2009-02-12 Thread Raj Mathur
On Friday 13 Feb 2009, Andreas wrote: > 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. >