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 checkCharacter(String character) {
        boolean flag = false;
        try {
            //String check = "[a-zA-Z0-9@.-]{6,20}";
            String check = "[1-9][0-9]{5,11}";
            Pattern regex = Pattern.compile(check);
            Matcher matcher = regex.matcher(character);
            flag = matcher.matches();
        } catch (Exception e) {
            flag = false;
        }
        return flag;
    }
}