user1609817 user1609817 - 2 years ago 82
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

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download