Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
i have been working on matching a legal uk number plate with the following regex expression , however this only matches new number plates like JS07 ZAS not the old J62 LNX format, i need a expression to match both and i cant work out how to match both type of plates.
var plateregex = "([A-HJ-PR-Y]{2}([0][1-9]|[1-9][0-9])|[A-HJ-PR-Y]{1}([1-9]|[1-2][0-9]|30|31|33|40|44|55|50|60|66|70|77|80|88|90|99|111|121|123|222|321|333|444|555|666|777|888|999|100|200|300|400|500|600|700|800|900))[ ][A-HJ-PR-Z]{3}$";
if (!platetext.match(plateregex)) {
var answer = window.confirm ("Non LEGAL Plate Detected ...");
}
well here is the regex expression i made to match both type of plates ^([A-HJ-PR-Y]{2,2}[056][0-9]\s?[A-HJ-PR-Y]{3,3})$|^([A-HJ-NP-Y]{1,3}[0-9]{2,3}?\s[A-Z]{3,3})$|^([A-Z]{1,3}\s?[0-9]{1,4}([A-Z]{1,1})?)$|^([0-9]{4,4}[A-Z]{1,3})$|^([A-Z]{1,2}\s?[0-9]{1,4})$|^([A-Z]{2,3}\s?[0-9]{1,4})$|^([0-9]{1,4}\s?[A-Z]{2,3})$
however this dosent match anything ? when it should do can you see any problems here for using with javascript regex ?