简体   繁体   中英

REGULAR EXPRESSIONS IN SQL AND SNOWFLAKE

I have a string and I want to remove all the digits and punctuations from the end of the string. I doing this on Snowflake

STRING:

1234 Pharmacy #344455

DESIRED OUTPUT:

1234 Pharmacy

Using REGEXP_REPLACE:

SELECT REGEXP_REPLACE('1234 Pharmacy #344455', '\\W*\\d*$') 
-- 1234 Pharmacy

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM