Java Regular Expression match QQ Number

Description

Java Regular Expression match QQ Number


//package com.demo2s;

import java.util.regex.Pattern;

public class Main {
    public static void main(String[] argv) throws Exception {
        String str = "1234567";
        System.out.println(isQQNumber(str));
    }/*  w  w  w.j  a v  a 2  s  .c  o  m*/

    private static final Pattern qqNumberPattern = Pattern.compile("^[1-9][0-9]{4,10}$");

    public static boolean isQQNumber(String str) {
        return qqNumberPattern.matcher(str).matches();
    }
}



PreviousNext

Related