I'm trying to form a regular expression for REGEXP_SUBSTR (Redshift)
which will extract the sub-domain & domain part from any given URL.
I tried many suggestions from stackoverflow: regular-expression-extract-subdomain-domain, getting-parts-of-a-url-regex, how-to-get-domain-name-from-url and etc. Some of them work on regex validator but don’t work on Redshift.
A regular expression should handle URLs with and without http/https prefix.
Is there any other way of extracting sub-domain & domain from any given URL using a regular expression?