I have a field in my database where users have saved free-form telephone numbers. As a result, the data has all sorts of different formatting:
- (area) nnn-nnnn
- area-nnn-nnnn
- area.nnn.nnnn
- etc
I would like to strip out all the non-numeric characters and just store the digits, but I can’t find a simple way to do this. Is it possible without using one REPLACE for each char?
You can use REGEXP_REPLACE since Oracle 10:
This example returns
349471234562013.Alternative syntaxes include:
POSIX character classes:
Perl-influenced extensions (since Oracle 11):