iOS 现有的运营商手机号正则表达式

来源:互联网 发布:淘宝双12活动报名 编辑:程序博客网 时间:2024/05/16 16:52


判断手机号码是否符合目前现有的运营商手机号码规范,包括虚拟运营商的手机号码段

+ (BOOL)isMobileNumber:(NSString *)mobileNum

{
    NSString * phoneRegex = @"^(13[0-9]|15[012356789]|17[678]|18[0235-9]|14[57])[0-9]{8}$";
    NSPredicate *regextestmobile = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",phoneRegex];
    BOOL isMatch = [regextestmobile evaluateWithObject:mobileNum];
    return isMatch;
}
0 0