当前位置:网站首页>Regular verification of mobile phone number and email [easy to understand]
Regular verification of mobile phone number and email [easy to understand]
2022-06-28 09:24:00 【Java architects must see】
private static String MOBILE_REGEX = "^(13[0-9]|15[012356789]|17[3678]|18[0-9]|14[57])[0-9]{8}$";
private static String EMAIL_REGEX = "^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+$";
/** * Regular verification of mobile phone number * @param str * @return */ public static boolean validateMobile(String str) {
Pattern pa = Pattern.compile(MOBILE_REGEX);
Matcher ma = pa.matcher(str);
while (ma.find()) {
return true;
}
return false;
}
/** * Mailbox regular validation * @param str * @return */ public static boolean validateEmail(String str) {
Pattern pa = Pattern.compile(EMAIL_REGEX);
Matcher ma = pa.matcher(str);
while (ma.find()) {
return true;
}
return false;
}边栏推荐
- 为什么SELECT * 会导致查询效率低?
- Edit the live broadcast source code with me. How to write the live broadcast app code
- 全局异常处理器与统一返回结果
- Is it safe for CICC fortune to open an account? How much do you charge?
- 满电出发加速品牌焕新,长安电动电气化产品吹响“集结号”
- Interpretation of new products: realm launched GT neo2 Dragon Ball customized version
- PMP考试重点总结九——收尾
- PMP needs to master its own learning methods
- English translation plug-in installation of idea
- DEJA_VU3D - Cesium功能集 之 051-地形开挖完美实现
猜你喜欢

数字人行业爆发在即,市场格局几何?

为什么SELECT * 会导致查询效率低?

Import and export of a single collection in postman

JVM系列(2)——垃圾回收

SQL optimization experience: from 30248 seconds to 0.001 seconds

满电出发加速品牌焕新,长安电动电气化产品吹响“集结号”

This article explains in detail the difficult problems and solutions faced by 3D cameras

How to reduce the risk of project communication?

虚拟机14安装win7(图教程)

P2394 yyy loves Chemistry I
随机推荐
小米旗下支付公司被罚 12 万,涉违规开立支付账户等:雷军为法定代表人,产品包括 MIUI 钱包 App
File operations in QT
线程和进程
1182:合影效果
Apiccloud, together with 360 Tianyu, helps enterprises keep the "first pass" of APP security
股票 停牌
RESTful风格
PMP考试重点总结七——监控过程组(1)
A classic JVM class loaded interview question class singleton{static singleton instance = new singleton(); private singleton() {}
P2394 yyy loves Chemistry I
Dbeaver connects to kingbasees V8 (ultra detailed graphic tutorial)
在本类私有属性直接使用?new()在使用!!!
Apache Doris becomes the top project of Apache
The digital human industry is about to break out. What is the market pattern?
How to implement two factor authentication MFA based on RADIUS protocol?
怎样在手机上开户?现在网上开户安全么?
基于宽表的数据建模
虚拟机14安装win7(图教程)
RMAN backup message ora-19809 ora-19804
1181: integer parity sort