//Mobile number Regular expressionNSString *cm_num =@"^ ((13[4-9)) | ( 147) | (15[0-2,7-9]) | (178) | (18[2-4,7-8])) \\d{8}| (1705) \\d{7}$"; //The regular expression of China Unicom segmentNSString *cu_num =@"^ ((13[0-2)) | ( 145) | (15[5-6]) | (176) | (18[5,6])) \\d{8}| (1709) \\d{7}$"; //Regular expression of electrical signal segmentNSString *ct_num =@"^ ((133) | ( 153) | (177) | (18[0,1,9])) \\d{8}$"; Nspredicate*pred1 = [Nspredicate predicatewithformat:@"Self MATCHES%@", Cm_num]; BOOL IsMatch1=[pred1 Evaluatewithobject:telephone]; Nspredicate*pred2 = [Nspredicate predicatewithformat:@"Self MATCHES%@", Cu_num]; BOOL ISMATCH2=[Pred2 Evaluatewithobject:telephone]; Nspredicate*PRED3 = [Nspredicate predicatewithformat:@"Self MATCHES%@", Ct_num]; BOOL IsMatch3=[Pred3 Evaluatewithobject:telephone]; if(ismatch1| | ismatch2| |IsMatch3) { returnYES; }Else{[Self alertwithtitle:@"Tips"Msg@"Please enter the correct mobile phone number"]; returnNO; }
Mobile phone number Regular expression