Java Email Validate isEmail(String msg)

Here you can find the source of isEmail(String msg)

Description

is Email

License

Open Source License

Declaration

public static boolean isEmail(String msg) 

Method Source Code


//package com.java2s;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {

    public static boolean isEmail(String msg) {
        Pattern pattern = Pattern
                .compile("^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$");
        Matcher matcher = pattern.matcher(msg);
        return matcher.matches();
    }/*from w w  w  . j  av a 2 s  .  co  m*/
}

Related

  1. isEmail(String email)
  2. isEmail(String email)
  3. isEmail(String email)
  4. isEmail(String emailAddress)
  5. isEmail(String input)
  6. isEmail(String s)
  7. isEmail(String str)
  8. isEmail(String str)
  9. isEmail(String str)