当前位置:网站首页>Common regular expressions
Common regular expressions
2022-04-23 07:22:00 【dotphoenix】
package com.modules.plateform.tool;
import java.util.regex.Pattern;
/**
* Account related attribute verification tool
*
*/
public class AccountValidatorUtil {
/**
* Regular expressions : Verify user name
*/
public static final String REGEX_USERNAME = "^[a-zA-Z]\\w{5,20}$";
/**
* Regular expressions : Verify password
*/
public static final String REGEX_PASSWORD = "^[a-zA-Z0-9]{6,20}$";
/**
* Regular expressions : Verify phone number
*/
public static final String REGEX_MOBILE = "^((17[0-9])|(14[0-9])|(13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$";
/**
* Regular expressions : Verify email
*/
public static final String REGEX_EMAIL = "^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";
/**
* Regular expressions : Verify Chinese characters
*/
public static final String REGEX_CHINESE = "^[\u4e00-\u9fa5],{0,}$";
/**
* Regular expressions : Verify ID card
*/
public static final String REGEX_ID_CARD = "(^\\d{18}$)|(^\\d{15}$)";
/**
* Regular expressions : verification URL
*/
public static final String REGEX_URL = "http(s)?://([\\w-]+\\.)+[\\w-]+(/[\\w- ./?%&=]*)?";
/**
* Regular expressions : verification IP Address
*/
public static final String REGEX_IP_ADDR = "(25[0-5]|2[0-4]\\d|[0-1]\\d{2}|[1-9]?\\d)";
/**
* Verify username
*
* @param username
* @return Verify by returning true, Otherwise return to false
*/
public static boolean isUsername(String username) {
return Pattern.matches(REGEX_USERNAME, username);
}
/**
* Check the password
*
* @param password
* @return Verify by returning true, Otherwise return to false
*/
public static boolean isPassword(String password) {
return Pattern.matches(REGEX_PASSWORD, password);
}
/**
* Check cell phone number
*
* @param mobile
* @return Verify by returning true, Otherwise return to false
*/
public static boolean isMobile(String mobile) {
return Pattern.matches(REGEX_MOBILE, mobile);
}
/**
* Checkbox
*
* @param email
* @return Verify by returning true, Otherwise return to false
*/
public static boolean isEmail(String email) {
return Pattern.matches(REGEX_EMAIL, email);
}
/**
* Check Chinese characters
*
* @param chinese
* @return Verify by returning true, Otherwise return to false
*/
public static boolean isChinese(String chinese) {
return Pattern.matches(REGEX_CHINESE, chinese);
}
/**
* Check ID card
*
* @param idCard
* @return Verify by returning true, Otherwise return to false
*/
public static boolean isIDCard(String idCard) {
return Pattern.matches(REGEX_ID_CARD, idCard);
}
/**
* check URL
*
* @param url
* @return Verify by returning true, Otherwise return to false
*/
public static boolean isUrl(String url) {
return Pattern.matches(REGEX_URL, url);
}
/**
* check IP Address
*
* @param ipAddr
* @return
*/
public static boolean isIPAddr(String ipAddr) {
return Pattern.matches(REGEX_IP_ADDR, ipAddr);
}
}
版权声明
本文为[dotphoenix]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230609059462.html
边栏推荐
- Chapter 8 generative deep learning
- [2021 book recommendation] Red Hat Certified Engineer (RHCE) Study Guide
- .net加载字体时遇到 Failed to decode downloaded font:
- 【点云系列】DeepMapping: Unsupervised Map Estimation From Multiple Point Clouds
- SSL/TLS应用示例
- [Point Cloud Series] SG - Gan: Adversarial Self - attachment GCN for Point Cloud Topological parts Generation
- [dynamic programming] triangle minimum path sum
- xcode 编译速度慢的解决办法
- 【 planification dynamique】 différentes voies 2
- 【点云系列】FoldingNet:Point Cloud Auto encoder via Deep Grid Deformation
猜你喜欢

Visual Studio 2019安装与使用
![[2021 book recommendation] practical node red programming](/img/f4/e397c01f1551cd6c59ea4f54c197e6.png)
[2021 book recommendation] practical node red programming

MySQL installation and configuration - detailed tutorial

Fill the network gap
![[3D shape reconstruction series] implicit functions in feature space for 3D shape reconstruction and completion](/img/4d/6d5821759766a6bf1d77ad51b69e24.png)
[3D shape reconstruction series] implicit functions in feature space for 3D shape reconstruction and completion

Chapter 2 pytoch foundation 2

Gephi教程【1】安装

机器学习 二:基于鸢尾花(iris)数据集的逻辑回归分类

【2021年新书推荐】Red Hat Certified Engineer (RHCE) Study Guide

Chapter 1 numpy Foundation
随机推荐
5种方法获取Torch网络模型参数量计算量等信息
【 planification dynamique】 différentes voies 2
【2021年新书推荐】Red Hat RHCSA 8 Cert Guide: EX200
机器学习——PCA与LDA
[2021 book recommendation] red hat rhcsa 8 cert Guide: ex200
torch. mm() torch. sparse. mm() torch. bmm() torch. Mul () torch The difference between matmul()
Reading notes - activity
电脑关机程序
face_recognition人脸检测
【指标】Precision、Recall
Five methods are used to obtain the parameters and calculation of torch network model
Bottom navigation bar based on bottomnavigationview
Component based learning (1) idea and Implementation
Chapter 5 fundamentals of machine learning
【3D形状重建系列】Implicit Functions in Feature Space for 3D Shape Reconstruction and Completion
[point cloud series] sg-gan: advantageous self attention GCN for point cloud topological parts generation
The Cora dataset was trained and tested using the official torch GCN
Visual studio 2019 installation and use
[Point Cloud Series] SG - Gan: Adversarial Self - attachment GCN for Point Cloud Topological parts Generation
PyTorch 13. 嵌套函数和闭包(狗头)