This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Email Validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Email Validation" Watch "Email Validation" New topic

Email Validation

ritchie diputado

Joined: Sep 19, 2003
Posts: 5
Im using RE from jakarta to validation email address.
Im now using this to validate my email addresses, based on the test its
quite OK.
Just want to check with you guys if this meets rfc822 or what am i missing.
RE r = new RE("^[a-zA-Z0-9]*[\\w\\.\\w\\-\\w\\+]*[a-zA-Z0-9]@[a-zA-Z0-9][\\w\\.\\w\\-]*[a-zA-Z0-9]\\.[a-zA-Z][a-zA-Z\\.]*[a-zA-Z]$");
if (!r.match(email)) return false;
else return true;
Or are there any codes which is better for validating email address.
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

Not really a Java question, but definitely not a Servlet question.
I'll move it to the Java in General (intermediate) forum. You'll have more luck there.
Jon Chan

Joined: Sep 21, 2003
Posts: 7
Please study the classes of java.util.regex
I agree. Here's the link:
subject: Email Validation
Similar Threads
regexp on email address
Jakarta RegExp - Email Validation
Email regEx- should not start with dot(.)
Email Address using java regular expression
Quick Javascript & RegEx quuestion