I want to make a regular expression that validates the field Lot
of my form.
The lot
has a length of 6 digits always, what can vary is that after the sixth digit it can have a letter from AZ.
I already have the simple part that is to validate from the beginning of the chain that they are numbers up to a permitted limit, leaving my expression like this:
let regular = /^([0-9]){1,10}$/;
Searching if there are matches from the first character to the tenth, which would be the limit.
How do I make it so that from the seventh character it validates if there is any letter from AZ? And if there is not let it pass, that is: 203945A true, 2039481 true, 39482849 false
(length 7 of numbers).
Try the following:
We search for any digit six times and optionally a character in the range az AZ.