I got this regex expression from REGEXlib and basically it checks to see if it is a valid UK DVLA Number Plate however i cannot get it to work within JavaScript could some one please help as im not the best with regex as it is.
//On change event for the textbox plate text
function setValue(target){
var platetext = target.value;
$('#numberplateyellow').empty();
$('#numberplatewhite').empty();
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 (document.platebuilder.target.value.search(plateregex)==-1){
var answer = window.confirm ("Non LEGAL Plate Detected (YES WE WILL SHOW THE AGREE BOX ONCE I HAVE IT FROM TOM) \n\n Do you understand that this is now classed as a show plate ?");
if (answer) {
$('#numberplateyellow').append(platetext);
$('#numberplatewhite').append(platetext);
}
}
}
Thanks
document.platebuilder.targetis the same as the function argumenttarget?