iOS经典讲解之正则表达式判断手机号码
来源:互联网 发布:淘宝入驻协议书 编辑:程序博客网 时间:2024/06/05 14:54
作者:Loving_iOS
转载请标明出处:http://blog.csdn.net/loving_ios/article/details/50786911
- (BOOL)checkTel:(NSString *)tel{ /** * 手机号码 * 移动:134[0-8],135,136,137,138,139,150,151,157,158,159,182,183,187,188 * 联通:130,131,132,152,155,156,185,186 * 电信:133,1349,153,180,189 */ NSString * MOBILE = @"^1(3[0-9]|5[0-35-9]|8[025-9])\\d{8}$"; /** 10 * 中国移动:China Mobile 11 * 134[0-8],135,136,137,138,139,150,151,157,158,159,182,187,188 12 */ NSString * CM = @"^1(34[0-8]|(3[5-9]|5[017-9]|8[2378])\\d)\\d{7}$"; /** 15 * 中国联通:China Unicom 16 * 130,131,132,152,155,156,185,186 17 */ NSString * CU = @"^1(3[0-2]|5[256]|8[56])\\d{8}$"; /** 20 * 中国电信:China Telecom 21 * 133,1349,153,180,189 22 */ NSString * CT = @"^1((33|53|8[09])[0-9]|349)\\d{7}$"; /** 25 * 大陆地区固话及小灵通 26 * 区号:010,020,021,022,023,024,025,027,028,029 27 * 号码:七位或八位 28 */ // NSString * PHS = @"^0(10|2[0-5789]|\\d{3})\\d{7,8}$"; NSPredicate *regextestmobile = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", MOBILE]; NSPredicate *regextestcm = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", CM]; NSPredicate *regextestcu = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", CU]; NSPredicate *regextestct = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", CT]; if (([regextestmobile evaluateWithObject:tel] == YES) || ([regextestcm evaluateWithObject:tel] == YES) || ([regextestct evaluateWithObject:tel] == YES) || ([regextestcu evaluateWithObject:tel] == YES)) { return YES; } else { return NO; }}
1 0
- iOS经典讲解之正则表达式判断手机号码
- iOS 正则表达式判断邮箱格式,手机号码
- iOS经典讲解之常用的正则表达式方法
- iOS 手机号码正则表达式
- iOS开发正则表达式 判断手机号码,邮箱格式是否正确
- iOS 根据正则表达式判断邮箱,手机号码,身份证...
- iOS 利用正则表达式判断手机号码格式是否合法
- 最新iOS判断手机号码是否正确正则表达式
- 几个ios正则表达式 判断邮箱 手机号码 身份证号码
- iOS用正则表达式判断是否为手机号码
- ios利用正则表达式判断手机号码格式是否正确
- ios利用正则表达式判断手机号码格式是否正确
- 判断手机号码的正则表达式
- 正则表达式判断手机号码运营商
- 正则表达式 判断手机号码是否合法
- 判断身份证手机号码正则表达式
- iOS-正则表达式:手机号码校验
- iOS最新手机号码正则表达式
- android studio 签名 报错Error:(3) Error: "app_name" is not translated in "de" (German), "es" (Spanish),
- github上的提交数统计
- Android网络通信库Volley简介
- 第一章 对象导论1.3/1.4合并
- Fatal: the Postfix mail system is already running 的解决方案
- iOS经典讲解之正则表达式判断手机号码
- jquery扩展的两个方法与区别
- 新博客地址,欢迎你们!
- Android静态变量的生命周期
- Linux下用户和密码相关
- 使用Node.js+Socket.IO搭建WebSocket实时应用
- 内存地址的变化
- GestureDetector手势识别--笔记
- Spring定时任务的几种实现