当前位置:网站首页>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;
}边栏推荐
- Rich text - Test Case
- Fastjason filter field
- 微信小程序开发日志
- Prototype chain JS
- Music website design based on harmonyos (portal page)
- 虚拟机14安装win7(图教程)
- Machine virtuelle 14 installer win7 (tutoriel)
- Common tools for interface testing --postman
- How to implement two factor authentication MFA based on RADIUS protocol?
- Find the total number of 1 appearing in the integer 1-N and the number of 1 in the binary of the integer
猜你喜欢

104. maximum depth of binary tree

Boundary value analysis method for learning basic content of software testing (2)

How to reduce the risk of project communication?
![[ybtoj advanced training guide] maximum separation [hash] [Floyd]](/img/86/542ab1728a2ddbc01592b2fa83491a.jpg)
[ybtoj advanced training guide] maximum separation [hash] [Floyd]

SQL optimization experience: from 30248 seconds to 0.001 seconds

P2394 yyy loves Chemistry I

全局异常处理器与统一返回结果

SQL injection file read / write

Chrome devtools

数字人行业爆发在即,市场格局几何?
随机推荐
构造方法绝不是在new()之后就立马执行!!!!!
I want to register my stock account online. How do I do it? Is online account opening safe?
Installation of containerd1.5.5
Dbeaver连接人大金仓KingbaseES V8(超详细图文教程)
DEJA_VU3D - Cesium功能集 之 051-地形开挖完美实现
Why does select * lead to low query efficiency?
HDI的盲孔设计,你注意到这个细节了吗?
File operations in QT
异常的产生,及解决
Automatic conversion - interview questions
线程的生命周期
Apache Doris 成为 Apache 顶级项目
Postman interface test
Implementation of single sign on
How to solve the problem of port number occupation
手机炒股开户安不安全?
How to implement two factor authentication MFA based on RADIUS protocol?
From knowledge to wisdom: how far will the knowledge map go?
DBeaver安装与使用教程(超详细安装与使用教程)
Basic content learning of software testing (I)