正则表达式常量类

/**
 * 正则表达式常量类
 *
 */
public class ValidationConstants {

    /**
     * 身份证正则
     */
    public final static String ID_CARD_PATTERN = "(\\d{6}(18|19|20)\\d{2}(0[1-9]|1[012])(0[1-9]|[12]\\d|3[01])\\d{3}(\\d|X|x))|(\\d{8}(0[1-9]|1[012])(0[1-9]|[12]\\d|3[01])\\d{3})$";

    /**
     * 密码正则
     */
    public static final String PASSWORD_PATTERN = "(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*\\W)^.{8,16}$";

    /**
     * 真实姓名正则
     */
    public static final String REAL_NAME_PATTERN = "[\u4E00-\u9FA5]{2,10}$";

    /**
     * 手机号码正则
     */
    public static final String PHONE_PATTERN = "1([2-9][0-9])\\d{8}$";

    /**
     * 邮箱正则
     */
    public static final String EMAIL_PATTERN = "[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$";

}

你可能感兴趣的:(JAVA,java,开发语言)