Click to See Complete Forum and Search --> : Regular expresssion


huggyd
07-16-2003, 09:48 AM
I need to validate Uk vehicle registration plates within an ASP page. For those of you outside the UK the format goes like this xx11xxx or x1(1)(1)xxx where x is any alpha and 1 is any numeric and (1) represents an optional numeric.

I know this is crying out for a regular expression but I've never used them and don't know where to start. Any help in either javascript (preferably) or vbscript much appreciated

Jeff Mott
07-16-2003, 11:23 AM
xx11xxx/^[a-z]{2}\d{2}[a-z]{3}$/ix1(1)(1)xxx/^[a-z]\d{1,3}[a-z]{3}$/i

huggyd
07-16-2003, 11:40 AM
Cool. I was almost there. That now works perfectly