主要是设定一个匹配正则 然后看是否能匹配对
NSString *string = "abc122";
NSString *regex = @"^abc[0-9]+,[0-9]+";
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex];
BOOL isValid = [predicate evaluateWithObject:string];
主要是设定一个匹配正则 然后看是否能匹配对
NSString *string = "abc122";
NSString *regex = @"^abc[0-9]+,[0-9]+";
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex];
BOOL isValid = [predicate evaluateWithObject:string];