当前位置:网站首页>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;
}边栏推荐
- Decision table method for basic content learning of software testing (2)
- Campus honey decoration of APP course design (e-commerce platform)
- Ingersoll Rand panel maintenance IR Ingersoll Rand microcomputer controller maintenance xe-145m
- PMP考试重点总结六——图表整理
- A strange execution plan. One table in the association query is not associated with any other tables
- DEJA_ Vu3d - 052 of cesium feature set - Simulation of satellite orbit (high altitude) effect
- 虚拟机14安装win7(图教程)
- Import and export of a single collection in postman
- Postman interface test
- Deployment of MySQL database in Linux Environment
猜你喜欢

JDBC connection database (MySQL) steps

详解final、finally和finalize

Assertions used in the interface automation platform

买卖股票费用计算

Why does select * lead to low query efficiency?

Prototype chain JS
![1180: fractional line delimitation /p1068 [noip2009 popularization group] fractional line delimitation](/img/1a/162b060a6498e58278b6ca50e4953c.png)
1180: fractional line delimitation /p1068 [noip2009 popularization group] fractional line delimitation

Ingersoll Rand panel maintenance IR Ingersoll Rand microcomputer controller maintenance xe-145m

HDI的盲孔设计,你注意到这个细节了吗?

Apache Doris 成为 Apache 顶级项目
随机推荐
Dbeaver连接人大金仓KingbaseES V8(超详细图文教程)
1182: group photo effect
How do I open an account on my mobile phone? Is it safe to open an account online now?
Deployment of MySQL database in Linux Environment
Linux下安装redis 、Windows下安装redis(超详细图文教程)
异常的产生,及解决
Is it safe for CICC fortune to open an account? How much do you charge?
The digital human industry is about to break out. What is the market pattern?
异常处理4种方法
Implementation of single sign on
Decision table method for basic content learning of software testing (2)
Apache Doris 成为 Apache 顶级项目
1180: fractional line delimitation /p1068 [noip2009 popularization group] fractional line delimitation
Divide and rule classic Hanoi
01-分布式系统概述
SQL 优化经历:从 30248秒到 0.001秒的经历
Expérience d'optimisation SQL: de 30248 secondes à 0001 secondes
When the interviewer asks you to write binarysort in two ways
剑指Offer | 斐波那契数列
数据挖掘建模实战