How to use regexp_replace to only keep the number after the dollar sign

Viewed 24

E.G. $21,438 (USA) (9 August 2009) I want to keep 21438 (without the , and as a float) Thank you so much!

1 Answers

Use REGEXP_SUBSTR() to get the number after $. Then replace $ and , with empty strings.

CAST(REGEXP_REPLACE(REGEXP_SUBSTR(column, '\\$[0-9,]+'), '[$,]', '') AS FLOAT)
Related