当前位置:网站首页>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;
}边栏推荐
猜你喜欢

1182: group photo effect

Resource scheduling and task scheduling of spark

English translation plug-in installation of idea

The digital human industry is about to break out. What is the market pattern?

Apache Doris becomes the top project of Apache

Deployment of MySQL database in Linux Environment

Calculation of stock purchase and sale expenses
![[ybtoj advanced training guidance] class roll call [string hash]](/img/5b/bbf8fa51d180b50fbbee4bcc278c70.jpg)
[ybtoj advanced training guidance] class roll call [string hash]

P2394 yyy loves Chemistry I

SQL 優化經曆:從 30248秒到 0.001秒的經曆
随机推荐
Understanding the IO model
RMAN backup message ora-19809 ora-19804
When the interviewer asks you to write binarysort in two ways
详解final、finally和finalize
异常处理4种方法
Rich text - Test Case
Machine virtuelle 14 installer win7 (tutoriel)
Ingersoll Rand panel maintenance IR Ingersoll Rand microcomputer controller maintenance xe-145m
Valentine's Day - VBS learning (sentences, love words)
当面试官让你用两种方式写BinarySort
Data modeling based on wide table
The constructor is never executed immediately after new()!!!!!
买卖股票费用计算
Stock suspension
Resource scheduling and task scheduling of spark
Write a simple timeline
Basic content learning of software testing (I)
SQL injection file read / write
满电出发加速品牌焕新,长安电动电气化产品吹响“集结号”
我想网上注册股票开户,如何操作?在线开户安全么?