package com.navinfo.outdoor.util;

import android.text.TextUtils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 手机号验证
 */
public class RegexUtil {
    public static boolean isPhone(String name) {
        if (TextUtils.isEmpty(name))return false;
        Pattern p = Pattern.compile("^1[3,4,5,6,7,8,9]\\d{9}$");
        Matcher m = p.matcher(name);
        return m.matches();
    }
    public static boolean checkPassword(String password) {
        if (TextUtils.isEmpty(password))return false;
        //字母+数字。最少6位的正则表达式
        Pattern p = Pattern.compile("(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,}");
        Matcher m = p.matcher(password);
        boolean isPassword = m.matches();
        return isPassword;
    }

}
