As many people are unaware, email addresses require a library to parse.  Simple regexes, like @(.*), are not sufficient. Email addresses can even contain comments, which can contain characters like @, breaking simple regexes.
There is a Node.js library that parses RFC 2822 addresses:
var address = addresses[0];
console.log("Email address: " + address.address);
console.log("Email name: " + address.name());
console.log("Reformatted: " + address.format());
console.log("User part: " + address.user());
console.log("Host part: " + address.host());
which is an almost direct port of the perl module Mail::Address.
This is something that I would expect to exist in Java's InternetAddress class, but it doesn't break things down any further than the full address, which can include e.g. user@gmail.com. But I'm trying to extract the gmail.com part, which it doesn't include a method to do.
I'm surprised I can't find a common library that solves this, but presumably many people have this problem. How can this be solved using a library or no?
 
     
    