美文网首页iOS点点滴滴
2019手机号码正则表达式

2019手机号码正则表达式

作者: 4335151e8554 | 来源:发表于2019-03-06 09:45 被阅读1次

^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(17[0,3,5-8])|(18[0-9])|166|198|199|(147))\\d{8}$

/*手机号码验证 MODIFIED BY HELENSONG*/
+ (BOOL)isValidateMobile:(NSString *)mobile{
    NSString *phoneRegex = @"^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(17[0,3,5-8])|(18[0-9])|166|198|199|(147))\\d{8}$";
    NSPredicate *phoneTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",phoneRegex];
    return [phoneTest evaluateWithObject:mobile];
}

相关文章

网友评论

    本文标题:2019手机号码正则表达式

    本文链接:https://www.haomeiwen.com/subject/ypwzuqtx.html