determine if the phone number is legal
+ (BOOL) Ischinamobile: (nsstring *) phonenum{
BOOL ischinamobile = NO;
nsstring *cm = @ "(^1 (3[4-9]|4[7]|5[0-27-9]|7[8]|8[2-478]) \\d{8}$) | ( ^1705\\d{7}$) ";
nspredicate *regextestcm = [nspredicate predicatewithformat:@ "self MATCHES%@", CM];
if([regextestcm evaluatewithobject:p honenum] = = YES) {
Ischinamobile = YES;
// NSLog (@ " China Mobile ");
}
nsstring *cu = @ "(^1 (3[0-2]|4[5]|5[56]|7[6]|8[56]) \\d{8}$) | ( ^1709\\d{7}$) ";
nspredicate *regextestcu = [nspredicate predicatewithformat:@ "self MATCHES%@", CU];
if([Regextestcu evaluatewithobject:p honenum] = = YES) {
Ischinamobile = YES;
// NSLog (@ " China Unicom ");
}
nsstring *ct = @ "(^1 (33|53|77|8[019]) \\d{8}$) | ( ^1700\\d{7}$) ";
nspredicate *regextestct = [nspredicate predicatewithformat:@ "Self MATCHES%@" , CT];
if([regextestct evaluatewithobject:p honenum] = = YES) {
Ischinamobile = YES;
// NSLog (@ " China Telecom ");
}
return ischinamobile;
}
determine if the mailbox is legitimate
+ (BOOL) Validateemail: (nsstring *) email{
nsstring *emailregex = @ "[A-z0-9a-z._%+-][email protected][a-za-z0-9.-]+\\.[ a-za-z]{2,4} ";
nspredicate *emailtest = [nspredicate predicatewithformat:@ "self MATCHES%@" , Emailregex];
return [emailtest evaluatewithobject: email];
}
Verify that the phone number/mailbox is legal