How to use Regex Extract in SQL Runner

Let’s say I have a column “URL” which consists of URL paths. e.g. “https://community.looker.com/topic/new?fid=10”, “https://community.looker.com/groups/data-explorers-guild-1012” etc..

How can I use regex extract to take whats before the last “/” and after the one before. 

From the top two respectively, I would ideally be extracting “topic”, ”groups”..

Solved Solved
0 1 1,254
1 ACCEPTED SOLUTION

What database are you using?

If using Redshift for example and the URLs are consistent you could use SPLIT_PART(string,delimiter,part)

SPLIT_PART(URL,’/’,4) should return topic in the first example.

View solution in original post

1 REPLY 1

What database are you using?

If using Redshift for example and the URLs are consistent you could use SPLIT_PART(string,delimiter,part)

SPLIT_PART(URL,’/’,4) should return topic in the first example.

Top Labels in this Space
Top Solution Authors