Validate an Email Address





9
Date Submitted Fri. Dec. 9th, 2005 2:13 PM
Revision 1 of 2
Coder mattrmiller
Tags "Email Address" | Java | String | Validate
Comments 2 comments
Validate an Email Address
        // Validate email address
        public static boolean validateEmail(String strEmail)
        {
                //Set the email pattern string
                Pattern pPattern = Pattern.compile(".+@.+\\.[a-z]+");

                //Match the given string with the pattern
                Matcher mMather = pPattern.matcher(strEmail);

                return mMather.matches();
        }

Matthew R. Miller

www.bluecreststudios.com
=================
Matthew R. Miller

http://bluecreststudios.com
http://www.codeandcoffee.com

Comments

Comments RFC 882 Compliant REGEX
Sun. Oct. 8th, 2006 11:51 AM    Newbie Caleb
Comments A better method
Mon. Feb. 20th, 2006 6:19 AM    Scripter TimYates

Voting