regex - Redshift regular expression for domain extraction -


i'm trying form regular expression regexp_substr (redshift) extract sub-domain & domain part given url.

i tried many suggestions stackoverflow: regular-expression-extract-subdomain-domain, getting-parts-of-a-url-regex, how-to-get-domain-name-from-url , etc. of them work on regex validator don’t work on redshift.

a regular expression should handle urls , without http/https prefix.

is there other way of extracting sub-domain & domain given url using regular expression?

after ton of experimentation, use:

replace(regexp_substr(url,'//[^/\\\,=@\\+]+\\.[^/:;,\\\\\(\\)]+'),'//','') 

need match double slash , remove replace because of quite basic regex supported redshift.

fwiw, you'll notice very different regex provided jeff barr in redshift udf's intro - regex produces nothing me.


Comments

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -