Java Email Validate isValidEmailAddress(String emailAddress)

Here you can find the source of isValidEmailAddress(String emailAddress)

Description

is Valid Email Address

License

Open Source License

Declaration

public static boolean isValidEmailAddress(String emailAddress) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
    public static boolean isValidEmailAddress(String emailAddress) {
        String expression = "(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])";
        CharSequence inputStr = emailAddress;
        Pattern pattern = Pattern.compile(expression, Pattern.CASE_INSENSITIVE);
        Matcher matcher = pattern.matcher(inputStr);
        return matcher.matches();
    }/*from  w  ww .  j a va  2  s .c o  m*/
}

Related

  1. isValidEmailAddress(String email)
  2. isValidEmailAddress(String email)
  3. isValidEmailAddress(String email)
  4. isValidEmailAddress(String email)
  5. isValidEmailAddress(String emailAddress)
  6. isValidEmailAddress(String emailAddress)
  7. isValidEmailAddress(String emailAddress)
  8. isValidEmailAddress(String emailAddress)
  9. isValidEmailAdress(String email)