Validating email in java
The servlet context is an interface which helps to communicate with other servlets.
It contains information about the Web application and container. Using the context, a servlet can obtain URL references to resources, and store attributes that other servlets in the context can use.
*/ User Info u = new User Info (); // loop until you get valid one(s) while (!
Ready()) final static Pattern rfc2822 = Pattern .compile ("[a-z0-9!
/* In a transactional/event-driven (GUI, web) app this would not be * a loop, but with a blocking/modal (tty) program it works.
The email’s domain name must start with “A-Za-z0-9-“, follow by first level Tld (.com, .net) “.[A-Za-z0-9]” and optional follow by a second level Tld (au, my) “\.[A-Za-z]”, where second level Tld must start with a dot “.” and length must equal or more than 2 characters.
Example Here's a class that validates email addresses through the static method © 2018 Hirondelle Systems | Source Code | Contact | License | RSS Individual code snippets can be used under this BSD license - Last updated on September 21, 2013.
If you like Geeksfor Geeks and would like to contribute, you can also write an article using contribute.or mail your article to [email protected]