郑永安
2023-06-19 7a6abd05683528032687c75e80e0bd2030a3e46c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package com.gkhy.safePlatform.account.utils;
 
import java.util.regex.Matcher;
import java.util.regex.Pattern;
 
public class RegexUtil {
 
    private static final String REGEX_MOBILE = "^((13[0-9])|(14[579])|(15([0-3]|[5-9]))|(16[56])|(17[0-8])|(18[0-9])|(19[1589]))\\d{8}$";
 
    private 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,}$";
 
    private static final String REGEX_PASSWORD = "";
 
 
 
    /**
     * 手机号码正则
     * @param phone
     * @return
     */
    public static Boolean isMobile(String phone) {
        return Pattern.compile(REGEX_MOBILE, Pattern.CASE_INSENSITIVE).matcher(phone).matches();
    }
 
    /**
     * 邮箱正则
     * @param email
     * @return
     */
    public static Boolean isEmail(String email) {
        return Pattern.compile(REGEX_EMAIL, Pattern.CASE_INSENSITIVE).matcher(email).matches();
    }
 
 
    /**
     * 密码正则匹配
     * @param password
     * @return
     */
    public static Boolean isPassword(String password) {
        return Pattern.compile(REGEX_PASSWORD, Pattern.CASE_INSENSITIVE).matcher(password).matches();
    }
 
 
}