Want a regex for validating Indian Vehicle Number Format?

前端 未结 11 1078
隐瞒了意图╮
隐瞒了意图╮ 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:12

    Say for example if the user already entered a value like:

    DL 
    

    then the textbox did not take the next input any other than a integer or one more char as.....

    DL C 
    

    from here user can only enter a integer value............

    So, in short what i want to do is to take the input only like that regex given by Alix

    Based on the Wikipedia Specs

    ^[A-Z]{2}[ -][0-9]{1,2}(?: [A-Z])?(?: [A-Z]*)? [0-9]{4}$
    

提交回复
热议问题