Click here to Skip to main content
15,881,380 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All
I want to validate indian vehicle No Using RegularExpressionValidator in asp.net
If it is pssible please revert
thanks...
Posted
Updated 3-May-11 20:57pm
v2
Comments
Sergey Alexandrovich Kryukov 4-May-11 2:58am    
Why do you think that everyone knows the format of this vehicle ID? You need to describe it. By the way, chances are, the process of formal describing it will help you to write the Regex pattern by yourself -- always much more useful... :-)
--SA
Legor 4-May-11 2:58am    
What exactly do you want to validate there?
Under which circumstances is a Vehicle No. valid?

Of course it is possible but your question is not clear.

Hi,

If you want to build a RegEx string, you could start by using the following tool: http://gskinner.com/RegExr/[^].

There, you can instantly try and test your regex, if it is working correctly.

Just as a starting point.


Hope this helps.

Best regards,
Stops
 
Share this answer
 
Comments
ambarishtv 4-May-11 3:08am    
nice link :) my 5
Christoph Keller 4-May-11 3:09am    
Thank you :)
Maddy_1008 4-May-11 3:17am    
this is the format for vehicle no
e.g. MH 12 SS 1111
Indian number plate format is quite simple according to Wiki[^]:

The first two letters of the registration plate represent the State in which the vehicle is Registered.
The next two digit numbers are the sequential number of a district. Due to heavy volume of vehicle registration, the numbers were given to the RTO offices of registration as well.
The third part is a 4 digit number unique to each plate. A letter(s) is prefixed when the 4 digit number runs out and then two letters and so on.


You can do a simple "dumb" validation in a Rexeg, but you might want to make it a bit more complex, to check state codes - I have no idea what they can be.

public static Regex regex = new Regex(
      "(?<state>\\w\\w)(?<sequence>\\d\\d(?<unique>\\w*\\d\\d\\d\\d"+
      "))",
    RegexOptions.IgnoreCase
    | RegexOptions.Singleline
    | RegexOptions.CultureInvariant
    | RegexOptions.Compiled
    );</unique></sequence></state>

This assumes you do not want to check if the number is actually issued - that is a whole other problem!
Get a copy of Expresso [^] - it's free, and it examines and generates Regular expressions.
 
Share this answer
 
Comments
ambarishtv 4-May-11 3:18am    
it might be the current format, but if you follow the older format of vehicle numbers you may need to come up with a general number format. Otherwise writing multiple regular expressions also may help based on each format
I dont think that India has an exact format for vehicle numbers. Its differing from state to state and as far as I know its not all the states following same format. If you have a known approved format for those please let me know
 
Share this answer
 
Comments
Maddy_1008 4-May-11 3:16am    
e.g.

MH 12 SS 1111

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900