regular expression for indian vehicle number in javascript and php

Posted by I Like PHP on Stack Overflow See other posts from Stack Overflow or by I Like PHP
Published on 2010-03-12T11:41:49Z Indexed on 2010/03/12 11:57 UTC
Read the original article Hit count: 288

Filed under:
|
|

i need regular expression in java script as well as in PHP for Indian vehicle NUMBER

here are conditions list

let expression is (x)(y)(z)(m)(a)(b)(c)

1. (x) contains only alphabets of length 2.

2. (y) may be - or single space ' '

3. (z) contains only numbers of length 2

4. (m) may be or , or single space ' '

5. length of (a) can be 2 or 3. contains alphanumeric value with minimum one alphabetic character.

6. (b) may be - or single space ' ' ( similar to (y) )

7. (c) contains only numbers of length 4

i show you the various examples of vehicle number

valid number

  1. RJ-14,NL-1234

  2. RJ-01,4M-5874

  3. RJ-07,14M-2345

  4. RJ 07,3M 2345

  5. RJ-07,3M-8888

  6. RJ 07 4M 2345

  7. RJ 07,4M 2933

    invalid number

    RJ-07 3M 1234 ( both (y) and (b) should be same).

    RJ-07 M3-1234 ((a) must ends with alphabat).

    rj-07 M3-123 ( length of (c) must be 4).

© Stack Overflow or respective owner

Related posts about regex

Related posts about php