Here you can find the source of isValidEmailAddress(String email)
Parameter | Description |
---|
public static final boolean isValidEmailAddress(String email)
//package com.java2s; /*/* ww w. j a v a 2s .c o m*/ * Copyright (c) Sofun Gaming SAS. * Copyright (c) Julien Anguenot <julien@anguenot.org> * Copyright (c) Julien De Preaumont <juliendepreaumont@gmail.com> * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Julien Anguenot <julien@anguenot.org> - initial API and implementation */ import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { /** * Checks if whether or not an email address is Valid. * * @param email: an email address as {@link String} * @return true or false. */ public static final boolean isValidEmailAddress(String email) { final String expression = "^[\\w\\-]([\\.\\w])+[\\w]+@([\\w\\-]+\\.)+[A-Z]{2,4}$"; final CharSequence inputStr = email; final Pattern pattern = Pattern.compile(expression, Pattern.CASE_INSENSITIVE); final Matcher matcher = pattern.matcher(inputStr); return matcher.matches(); } }