车牌号
/**
* 验证车牌号
*
* @return YES
*/
- (BOOL)validateLicensePlate:(NSString *)licensePlate
{
NSString *regex = @"^[\\u4e00-\\u9fa5]{1}[A-Z]{1}[A-Z_0-9]{5}$";
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex];
if ([predicate evaluateWithObject:licensePlate]) {
return YES;
} else {
return NO;
}
}
网友评论