update: there are situations that dot position that might not be the best solution.
I got a column of website.
x
website
www.abc.google.com
www.bcd.google.com
wwww.efd.google.co.za
I want to transform it into
website
google.com
google.com
google.co.za
Anyone knows how to split based on the ‘.’ position from the right?
Thanks.
Advertisement
Answer
regexp_substr()
does exactly what you want:
select regexp_substr('www.abc.google.com', '[^.]*[.][^.]*$')