Q:

Regular expression to validate input from 4 or 5 character the first 3 should be alwas letters

How can I validate input: must be at least 4 character, and maximum 5 character. The last one is number, and the last 2 should be numbers. for example: 

WER4

or 

ASD23

Does it mean that the first 3 character should be always letters?
I don't know much about regex.

A:

The regular expression could look like this:
^[a-zA-Z]{3}[0-9]{1,2}$

^ is denoting the beginning of the string
[a-zA-Z] is a character class that includes all uppercase and lowercase letters from A to Z
{3} requires three consecutive occurences of that aforementioned character class
[0-9] is a character class that includes all numbers from 0 to 9
{1,2} requires at least one, maximum two consecutive occurences of that character class
$ is denoting the end of the string

<form>
<input type="text" pattern="^[a-z]{3}[0-9]{1,2}$" maxlength="5" required />
<input type="submit" />
</form>

