Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

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

public class Main {

    public static boolean isEmail(String strEmail) {
        String strPattern = "[a-zA-Z0-9][\\w\\.-]*[a-zA-Z0-9][@][\\w\\-]{1,}([.]([\\w\\-]{1,})){1,3}$";

        Pattern p = Pattern.compile(strPattern);
        Matcher m = p.matcher(strEmail);
        return m.matches();
    }
}