Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Snowflake SQL – how to extract words from a string

I have a string in a column like this.

I have 2 pets. One is "CAT" and "DOG".

I wanted to extract my output as "CAT" and "DOG". Which is the beginning of double quotes to end of double quotes. How can I achieve this using snowflake SQL

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Something like this works:

select regexp_substr('I have 2 pets. One is "CAT" and "DOG".', '".*"');

Output:

REGEXP_SUBSTR('I HAVE 2 PETS. ONE IS "CAT" AND "DOG".', '".*"')
"CAT" and "DOG"
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading