I want to limit the number of letters at the beginning and end of the input value (e.g. QQ23F and SG21G) through JavaScript but I found that only one {} can be written in a pattern. Thanks for any help. Here is my incorrect code:
var isValid = true;
var id=document.getElementById("pid").value;
if (!id.match(/[A-Za-z]{2}+[0-9]+[A-Za-z]{1}/)) {
document.getElementById("pidMessage").innerHTML="Your pid format is invalid!";
isValid = false;
}
{2}+is invalid; did you mean perhaps{2,}(for 2 or more)?{2}and get rid of the+