Want a regex for validating Indian Vehicle Number Format?

前端 未结 11 943
隐瞒了意图╮
隐瞒了意图╮ 2021-01-31 21:35

Hello everyone here...

I need to build up a swing application related to vehicle registration and in which i want to do input the vehicle number of indian standard, like

11条回答
  •  孤街浪徒
    2021-01-31 22:21

    -(BOOL) validateVehicleRegNumber:(NSString *)strNumber { //Example MH14DA8904

        NSString *validReg = @"[A-Z]{2}[0-9]{2}[A-Z]{2}[0-9]{4}";
        NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", validReg];
        return [emailTest evaluateWithObject:strNumber];
    

    }

提交回复
热议问题