正则表达规则

/** 只含有数字和字母 */
    public static final String ONLY_LETTER_DIGIT_REGEX = "^[a-zA-Z0-9]+$";
    
    /** 只含有数字,字母,下划线和汉字 */
    public static final String ONLY_LETTER_DIGIT_CHINESE_REGEX = "^[\\w-\u4e00-\u9fa5]+$";
    
    /** 只含有数字和字母,字母开头,数字结尾,字母可为空,数字不可为空 */
    public static final String BEGIN_LETTER_END_DIGIT_REGEX = "^[a-zA-Z]*[0-9]+$";
    
    /** 手机号码校验 */
    public static final String PHONE_REGEX = "^[\\+86]?[1][0-9]{10}$";
    
    /** 邮箱校验 */
    public static final String EMAIL_REGEX = "^[\\w-]+@[\\w-]+(\\.[\\w-]+)+$";
    
    /** 邮编校验 */
    public static final String POSTCODE_REGEX = "^[0-9]{6}$";

    /** 时间范围校验 */
    public static final String TIME_RANGE_REGEX = "^([0,1]\\d|2[0-3])(:[0-5]\\d){2}-([0,1]\\d|2[0-3])(:[0-5]\\d){2}$";

    /** 时间范围校验,允许多组 */
    public static final String TIME_RANGE_REGEX_S = "^([0,1]\\d|2[0-3])(:[0-5]\\d){2}-([0,1]\\d|2[0-3])(:[0-5]\\d){2}(,([0,1]\\d|2[0-3])(:[0-5]\\d){2}-([0,1]\\d|2[0-3])(:[0-5]\\d){2})*$";

  

posted @ 2020-11-24 16:26  怀梦_lqb  阅读(122)  评论(0编辑  收藏  举报