- 首页 > it技术 > >
public final class RegexConstants{
/**
*Regex of simple mobile.简单的手机格式
*/
public static final String REGEX_MOBILE_SIMPLE ="^[1]\\d{10}$";
/**
* 额外的手机号格式
* china mobile: 134(0-8), 135, 136, 137, 138, 139, 147, 150, 151, 152, 157, 158, 159, 178, 182, 183, 184, 187, 188, 198
* china unicom: 130, 131, 132, 145, 155, 156, 166, 171, 175, 176, 185, 186
* china telecom: 133, 153, 173, 177, 180, 181, 189, 199
* 【封装基本常用的正则表达式】global star: 1349
* virtual operator: 170
*/
public static final String REGEX_MOBILE_EXACT = "^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(16[6])|(17[0,1,3,5-8])|(18[0-9])|(19[8,9]))\d{8}$";
}
/**
*座机号
*/
public static final String REGEX_TEL="^0\\d{2,3}[- ]?\\d{7,8}";
/**
* Regex of id card number which length is 15. 15位身份证号
*/
public static final String REGEX_ID_CARD15= "^[1-9]\\d{7}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}$";
/**
* Regex of id card number which length is 18. 18位身份证号
*/
public static final String REGEX_ID_CARD18= "^[1-9]\\d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}([0-9Xx])$";
/**
* Regex of email. 邮箱
*/
public static final String REGEX_EMAIL= "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$";
/**
* Regex of url. url格式
*/
public static final String REGEX_URL= "[a-zA-z]+://[^\\s]*";
/**
* Regex of Chinese character. 中文
*/
public static final String REGEX_ZH= "^[\\u4e00-\\u9fa5]+$";
/**
* Regex of username. 长度为6到20的用户名,字符范围"a-z", "A-Z", "0-9", "_", "Chinese character"
* scope for "a-z", "A-Z", "0-9", "_", "Chinese character"
* can't end with "_"
* length is between 6 to 20
*/
public static final String REGEX_USERNAME= "^[\\w\\u4e00-\\u9fa5]{6,20}(?
推荐阅读