Solved

How to use Regex Extract in SQL Runner

  • 6 November 2020
  • 1 reply
  • 257 views

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”..

 

 

icon

Best answer by JenniferThomas 6 November 2020, 19:45

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 original

1 reply

Userlevel 2

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.

Reply