NSString *str = @"13511112222";
NSString *regex = @"[0-9]{11}";
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",regex];
BOOL isMatch = [pred evaluateWithObject:str];
这个isMatch就是判断结果啦~
NSString *str = @"13511112222";
NSString *regex = @"[0-9]{11}";
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",regex];
BOOL isMatch = [pred evaluateWithObject:str];
这个isMatch就是判断结果啦~