用来备份,方便自己使用,需要的拿去
#pragma mark --判断手机号合法性
+ (BOOL)checkPhone:(NSString*)phoneNumber
{
NSString*regex =@"^((13[0-9])|(147)|(15[^4,\\D])|(18[0-9])|(17[0-9]))\\d{8}$";
NSPredicate*pred = [NSPredicatepredicateWithFormat:@"SELF MATCHES %@", regex];
BOOLisMatch = [predevaluateWithObject:phoneNumber];
if(!isMatch)
{
returnNO;
}
returnYES;
}
#pragma mark 判断邮箱
+ (BOOL)checkEmail:(NSString*)email{
//^(\\w)+(\\.\\w+)*@(\\w)+((\\.\\w{2,3}){1,3})$
NSString*regex =@"^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$";
NSPredicate*emailTest = [NSPredicatepredicateWithFormat:@"SELF MATCHES %@", regex];
return[emailTestevaluateWithObject:email];
}