Skip to content
Advertisement

Snowflake SQL, how to lookahead until a certain occurrence of a value

Below is a sample of the text that I am working with.

And I am trying to select the following text:

I was trying to use a look ahead, but haven’t had much success. REGEXP_SUBSTR(col, 'Type:(.*---)') Here I am trying to look up until the next occurrence of ‘—‘, but I think I misunderstanding how it works.

Advertisement

Answer

You don’t need regexp lookahead to get the string you want, it’s just eg.

If you need regexps with lookahead, etc, use JavaScript RegExps via a function wrapper, eg.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement