package com.corewing.app.util;

import java.util.regex.Pattern;

public class AccountUtil {

    /**
     * 手机号正则
     */
    private static final Pattern PHONE_PATTERN = Pattern.compile("^1[3-9]\\d{9}$");

    /**
     * 邮箱正则
     */
    private static final Pattern EMAIL_PATTERN = Pattern.compile("^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$");

    /**
     * 校验是否是手机号
     * @param email
     * @return
     */
    public static boolean isEmail(String email) {
        return EMAIL_PATTERN.matcher(email).matches();
    }

    /**
     * 校验是否是手机
     * @param phoneNumber
     * @return
     */
    public static boolean isPhone(String phoneNumber) {
        return PHONE_PATTERN.matcher(phoneNumber).matches();
    }

}
