I am trying to check if a form input is valid based on a regex pattern using javascript.
The form input should look like this: xxxx-xxx-xxxx allowing for both numbers and letters
Right now it only works with digits as I have it setup which is now being changed to allow letters as well. is there a way to change the regex I have to allow numbers and letters and still format as is?
4 letters or numbers A DASH 3 letters or numbers A DASH 4 letters or numbers
validation rule
medNumber: [
{
required: true,
pattern: /^\d{4}?[- ]?\d{3}[- ]?\d{4}$/,
message: "Please enter your #.",
trigger: ["submit", "change", "blur"]
}
],