Is there a way to split a column into tokens, and join them (like you can in other programming languages such as Python, Java, Ruby)
I have a column with urls such as "http://www.Yahoo.com", and I want to extract "Yahoo.com" from it (the main domain, NOT the subdomain). The urls can be of the forms:
- http://www.domain.com
- http://domain.com
- http://domain.com/page/page1
- http://www.domain.com/
- http://www.domain.com/page/page2
I was planning on using a regex to extract everything after http:// and before the next slash. Then splitting the url by the period (.), then joining the last 2 tokens.
With the regex, I can extract www.yahoo.com from http://www.yahoo.com. With the splits/joins, I can get yahoo.com from www.yahoo.com. Problem is I don't know how to do split/joins with Postgres.
Anyone know of a way? Or better alternative?