Using regexp_substr in snowflake to extract digits

Viewed 371

I'm trying to do this but it gives "NULL". Why?

select regexp_substr('07.31.19.csv','/[^0-9]+/'); 

I want to only keep the digits: "073119" Any ideas?

1 Answers

What are the slashes for? Instead, just use regexp_replace() and remove all non-digits:

select regexp_replace('07.31.19.csv', '[^0-9]', ''); 

I am not familiar with a fiddle for Snowflake. However, here is a fiddle that uses MySQL.

Related