1、判断邮箱格式(swift)
let regex = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,6}"
let testEmail = NSPredicate(format:"SELF MATCHES %@", regex)
let status = testEmail.evaluateWithObject(emailText)//BOOL
2、判断是否是手机号(OC)
- (BOOL)isPhoneNum{
NSString *MOBILE = @"^1(3[0-9]|4[57]|5[0-35-9]|8[0-9]|7[0678])\\d{8}$";
NSPredicate *regextestmobile = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", MOBILE];
return [regextestmobile evaluateWithObject:self.numberTF.text];
}