Example usage for java.util.regex Pattern compile

List of usage examples for java.util.regex Pattern compile

Introduction

In this page you can find the example usage for java.util.regex Pattern compile.

Prototype

public static Pattern compile(String regex) 

Source Link

Document

Compiles the given regular expression into a pattern.

Usage

From source file:Main.java

public static boolean isNumeric(String url) {
    Pattern patt = Pattern.compile("[0-9]*");
    Matcher matcher = patt.matcher(url);
    return matcher.matches();
}

From source file:Main.java

public static boolean isPrice(String params) {
    Pattern pattern = Pattern.compile("\\d{1,10}(\\.\\d{1,2})?$");
    Matcher matcher = pattern.matcher(params);
    return matcher.matches();
}

From source file:Main.java

public static boolean isMobileNO(String mobiles) {
    Pattern p = Pattern.compile("^((13[0-9])|(15[^4,//D])|(18[0,5-9]))//d{8}$");
    Matcher m = p.matcher(mobiles);
    return m.matches();
}

From source file:Main.java

public static boolean isMobileNO(String mobiles) {
    Pattern p = Pattern.compile("^((13[0-9])|(15[^4,\\D])|(17[6-8])|(18[0-9]))\\d{8}$");
    Matcher m = p.matcher(mobiles);
    return m.matches();
}

From source file:Main.java

public static boolean is15IDcard(String idString) {
    Pattern p = Pattern.compile("^[1-9]\\d{7}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}$");
    Matcher m = p.matcher(idString);
    return m.matches();
}

From source file:Main.java

public static boolean isZipNO(String zipString) {
    String str = "^[1-9][0-9]{5}$";
    return Pattern.compile(str).matcher(zipString).matches();
}

From source file:Main.java

public static boolean isMobileNum(String mobiles) {
    Pattern p = Pattern.compile("^((13)|(14)|(15)|(17)|(18))\\d{9}$");
    Matcher m = p.matcher(mobiles);
    return m.matches();
}

From source file:Main.java

public static boolean isValidCharacters(String s) {
    Pattern p = Pattern.compile("^[0-9a-zA-Z]{6,9}$");
    Matcher m = p.matcher(s);/*ww w.  j  a  v a 2 s.c o m*/
    return m.matches();
}

From source file:Main.java

public static boolean isValid_bec_kdh(String kdh) {
    Pattern p = Pattern.compile("^CN\\d{3}");
    Matcher m = p.matcher(kdh);/*from   ww w . jav a 2s  .com*/
    return m.matches();
}

From source file:Main.java

public static boolean isMobileNoAll(String mobiles) {
    Pattern p = Pattern.compile("^1[3|4|5|8][0-9]\\d{8}$");
    Matcher m = p.matcher(mobiles);
    return m.matches();
}