com.github.dennisit.vplus.data.utils.RegexUtils Maven / Gradle / Ivy
/*--------------------------------------------------------------------------
* Copyright (c) 2010-2020, Elon.su All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the elon developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Elon.su, you can also mail [email protected]
*--------------------------------------------------------------------------
*/
package com.github.dennisit.vplus.data.utils;
/**
* Created by Elon.su on 17/5/13.
*/
public class RegexUtils {
/**
* 用户名
*/
public static final String USER_NAME = "^[a-zA-Z\\u4E00-\\u9FA5][a-zA-Z0-9_\\u4E00-\\u9FA5]{1,11}$";
/**
* 密码
*/
public static final String USER_PASSWORD = "^.{6,32}$";
/**
* 邮箱
*/
public static final String EMAIL = "^\\w+([-+.]*\\w+)*@([\\da-z](-[\\da-z])?)+(\\.{1,2}[a-z]+)+$";
/**
* 手机号
*/
public static final String PHONE = "^1[34578]\\d{9}$";
/**
* 手机号或者邮箱
*/
public static final String EMAIL_OR_PHONE = EMAIL + "|" + PHONE;
/**
* URL路径
*/
public static final String URL = "^(https?:\\/\\/)?([\\da-z\\.-]+)\\.([a-z\\.]{2,6})(:[\\d]+)?([\\/\\w\\.-]*)*\\/?$";
/**
* 身份证校验,初级校验,具体规则有一套算法
*/
public static final String ID_CARD = "^\\d{15}$|^\\d{17}([0-9]|X)$";
/**
* 域名校验
*/
public static final String DOMAIN = "^[0-9a-zA-Z]+[0-9a-zA-Z\\.-]*\\.[a-zA-Z]{2,4}$";
}