I want a regular expression which accept 3 letters at least and 16 as max and which accept this following : all letters A to Z upper case and lower case and the .(dot) and numbers
I am using JavaScript
I want a regular expression which accept 3 letters at least and 16 as max and which accept this following : all letters A to Z upper case and lower case and the .(dot) and numbers
I am using JavaScript
A simple regex to do this is the following:
^[A-Za-z0-9.]{3,16}$
The regex works as follows:
[A-Za-z0-9.]
accepts any character you have specified;{3,16}
means repeating it 3
to 16
times; and^
and $
means the start and end fo the string. So that it does not match other parts of the string.Thus:
var str = "Wa89dadb...w";
var res = str.match(/^[A-Za-z0-9.]{3,16}$/g);