I've been trying to figure out how to remove multiple non-alphanumeric or non-numeric characters, or return only the numeric characters from a string. I've tried:
SELECT
regexp_extract('X789', '[0-9]', 0)
FROM
table_name
But it returns '7', not '789'.
I've also tried to remove non-numeric characters using NOT MATCH syntax ^((?!regexp).)*$:
SELECT
REGEXP_REPLACE('X789', '^((?![0-9]).)*$', '')
FROM
jav_test_ii
Can regexp_extract return multiple matches? What I'm really trying to do is clean my data to only contain numbers, or alphanumeric characters. This seems to help remove bad characters, but its not a range of characters like [0-9] is. regexp_replace(string, '�','')
EDIT: The query below was able to return '7789', which is exactly what I was looking for.
SELECT
regexp_replace("7X789", "[^0-9]+", "")
FROM
table_name