I attempted to use substring()
with regex but haven't found the best approach.
Here’s an SQL query that partially works:
SELECT substring(email_from FROM '<[^@]+@([^>]+)>') AS domain
FROM my_table;
For the input Lucky kurniawan <[email protected]>
, it correctly returns:
hotmail.com