Is string an Email address : Email « Network « Android






Is string an Email address

 

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

class Main {

    public static final String EMAIL_PATTERN_STR = "^(.+)@(.+)$";
  private static final Pattern EMAIL_PATTERN = Pattern
      .compile(EMAIL_PATTERN_STR);
  public static boolean isEmail(String text) {

    Matcher m = EMAIL_PATTERN.matcher(text);
    if (!m.find()) {
      return false;
    } else {
      return true;
    }
  }
}

   
  








Related examples in the same category

1.Email vis Intent
2.Builds a list of the recipients email addresses each on a different line
3.Send email
4.isValidEmailAddress: Check the email address is Valid
5.Launch the email intent
6.start Email Intent
7.start Html Email Intent