package com.huimv.env.admin.common.utils;

import java.util.regex.Pattern;

public class PhoneNumberValidator {

    public static boolean isValidPhoneNumber(String phoneNumber) {
        // 正则表达式用于验证手机号
        String pattern = "1[3456789]\\d{9}";

        // 判断输入的手机号是否符合规则
        return Pattern.matches(pattern, phoneNumber);
    }

    public static void main(String[] args) {
        String phoneNumber = "手机号"; // 替换为要验证的手机号
        boolean isValid = isValidPhoneNumber(phoneNumber);
        if (isValid) {
            System.out.println("手机号正确！");
        } else {
            System.out.println("手机号错误！");
        }
    }
}

