标签:for sp on bs return ca nbsp net string
+ (BOOL) validateEmail:(NSString *)email
{
NSString *emailRegex = @"^[\\w-]+(\\.[\\w-]+)*@[\\w-]+(\\.[\\w-]+)+$";
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex];
return [emailTest evaluateWithObject:email];
}
//手机号码验证
+ (BOOL) validateMobile:(NSString *)mobile
{
//手机号以13, 15,18开头,八个 \d 数字字符
NSString *phoneRegex = @"^((13[0-9])|(15[^4,\\D])|(18[0,0-9]))\\d{8}$";
NSPredicate *phoneTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",phoneRegex];
return [phoneTest evaluateWithObject:mobile];
}
+ (BOOL) validateQQ:(NSString *)qq
{
NSString *qqRegex = @"^[0-9]{5,12}$";
NSPredicate *qqTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",qqRegex];
return [qqTest evaluateWithObject:qq];
}
标签:for sp on bs return ca nbsp net string
原文地址:http://www.cnblogs.com/huntaiji/p/4043977.html