I have a table with column called URL. I am trying to extract different parts of URL using REGEX_SUBSTR
function in Redshift.
URL Expected_output
------------
www.abcd.com/first-name | first-name
www.abcd.com/another-name/some-details/other | another-name
www3.abcd.com/some-name/ | some-name
form.abcd.com/another-first-name | another-first-name
So the intention is to extract the first slug after the domain name
I tried
SELECT REGEXP_SUBSTR('www.abcd.com/slug-name', '(www|www3|form)[.]abcd[.][^/]+/([^/#?]+)',1,2)
Output
www.abcd.com/slug-name