user1609817 user1609817 - 10 months ago 37
SQL Question

Remove part of an email address

I have emails like

I am looking to select out everything after the
and before the

Result should be


Simple regex pattern should do the job.

SELECT regexp_matches('', '@([^.]+)\.');

SQL Fiddle

Edit: fixed to support subdomains. I assume you want to get the part before first dot.