Here you can find the source of checkEmailAddress(String address)
Parameter | Description |
---|---|
address | - The given string to be checked as email address |
Parameter | Description |
---|---|
NullPointerException | address is null. |
public static boolean checkEmailAddress(String address)
//package com.java2s; //License from project: Apache License import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { private static final Pattern PTN_EMAIL_ADDRESS = Pattern.compile("[\\w.-]+@[\\w.-]+"); /**//from ww w . j av a 2s .c o m * Check the given string to match the email format * * @param address - * The given string to be checked as email address * @return true if the given string is of email format. Other wise false * @throws NullPointerException * address is null. */ public static boolean checkEmailAddress(String address) { Matcher m = PTN_EMAIL_ADDRESS.matcher(address); return m.matches(); } }