If it doesn't find any matches then it will fail the validation and the function will return false, if the match returns true then the email will be of a correct format and the function will return true.
I ended up using a suggestion from here and adjusting the code so it would work in Java.
when they are trying to register for your web service).
With almost anything allowed in the username part of the email and so many new domains being added literally every month (e.g.
.company, .entreprise, .estate), it's safer not to be restrictive: Late to the question, here, but: I maintain a class at this address: It is based on Les Hazlewood's class, but has numerous improvements and fixes a few bugs. I believe it is the most capable email parser in Java, and I have yet to see one more capable in any language, though there may be one out there. Perl5Util which is from a retired Jakarta ORO project.
It's not a lexer-style parser, but uses some complicated java regex, and thus is not as efficient as it could be, but my company has parsed well over 10 billion real-world addresses with it: it's certainly usable in a high-performance situation. BTW, I found that there is a 1.4 version, here are the API docs.