正则汇总 个人汇总 不断更新中

前端之家收集整理的这篇文章主要介绍了正则汇总 个人汇总 不断更新中前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
/*手机号码验证 MODIFIED BY HELENSONG*/ + (BOOL) isValidateMobile:(NSString *)mobile { //手机号以13, 15,18开头,八个 \d 数字字符 NSString *phoneRegex = @"^((13[0-9])|(147)|(15[^4,\\D])|(18[0-9]))\\d{8}$"; NSPredicate *phoneTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",phoneRegex]; // //NSLog(@"phoneTest is %@",phoneTest); return [phoneTest evaluateWithObject:mobile]; } //匹配Email地址的正则表达式:^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((.[a-zA-Z0-9_-]{2,3}){1,2})$ // + (BOOL)isRightEmail:(NSString *)str { NSString *phoneRegex = @"^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((.[a-zA-Z0-9_-]{2,2})$"; NSPredicate *phoneTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",phoneTest); return [phoneTest evaluateWithObject:str]; } //17位 最后4位必须是数字 - (BOOL)isRightCarUniqueNumber:(NSString *)str { NSString *phoneRegex = @"^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((.[a-zA-Z0-9_-]{2,phoneTest); return [phoneTest evaluateWithObject:str]; } 原文链接:https://www.f2er.com/regex/362544.html

猜你在找的正则表达式相关文章