I'd like to update a column with just the domain part of an email address.
update
users
set
email_base_domain = regexp_match(email, '(\w+\.\w+)$')
However, regexp_match
returns a text[]
. If email is example@foo.com
the above sets email_base_domain to {foo.com}
. I would like foo.com
.
How do I get just the first element as text
from the text[]
returned by regexp_match
?