Skip to content

Instantly share code, notes, and snippets.

@donpandix donpandix/
Last active Jan 20, 2017

What would you like to do?
Función de validación de la forma de las cuentas de correo con expresiones regulares en Java
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class FN {
* Valida la forma de una dirección de correo
* @param email cadena de texto con el email a validar
* @return
public static Boolean validaEmail (String email) {
Pattern pattern = Pattern.compile("^([0-9a-zA-Z]+[-._+&])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$");
Matcher matcher = pattern.matcher(email);
return matcher.matches();
// Elemplo de implementación
public static void main (String[] args) {
if ( ! FN.validaEmail("soyEmail@invalido") {
System.out.println("Email malo!!!");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.