Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static boolean isValidEmailAddress(String email) {

        String EMAIL_REGEX = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@"
                + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";

        return email.matches(EMAIL_REGEX);
        //        Pattern p = Pattern.compile(EMAIL_REGEX);
        //        if (!(p.matcher(email).matches()))
        //            return false;
        //        return true;
    }
}