//determine the phone number+ (BOOL) Validatemobile: (NSString *) mobilenum{//Mobile phone numberNSString * MOBILE =@"^1 (3[0-9]|5[0-35-9]|8[025-9]) \\d{8}$"; //Mobile: China MobileNSString * CM =@"^1 (34[0-8]| ( 3[5-9]|5[017-9]|8[278] \\d) \\d{7}$"; //China Unicom: UnicomNSString * CU =@"^1 (3[0-2]|5[256]|8[56]) \\d{8}$"; //China Telecom: TelecomNSString * CT =@"^1 ((33|53|8[09]) [0-9]|349) \\d{7}$"; 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:mobilenum] = =YES)|| ([regextestcm evaluatewithobject:mobilenum] = =YES)|| ([regextestct evaluatewithobject:mobilenum] = =YES)|| ([regextestcu evaluatewithobject:mobilenum] = =YES)) { returnYES; } Else { returnNO; }}
Determine the phone number