As many people do not know, email addresses require the library to parse. Simple regular expressions like @(.*) Are not enough. Email addresses may contain comments, which may contain @ characters, breaking simple regular expressions.
There is a Node.js library that parses the addresses of RFC 2822:
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 Mail::Address module.
This is what I would expect to exist in the Java class InternetAddress , but it does not break anything further than the full address, which may include, for example, user@gmail.com . But I'm trying to extract the part of gmail.com in which it does not include the method.
I am surprised that I cannot find a common library that solves this, but probably many people have this problem. How can this be solved using the library or not?
source share