Find an alphanumeric regular expression about the user name?

regular requirements are: lowercase letter beginning, + number / letter / minus sign, minimum 3 digits, maximum 16 digits .

I referred to some Baidu materials myself, and I was so close to ok. Now I have a small problem and I can"t tune it out.

/^[a-z][a-z1-9-]{3,16}$/

I typed 4 aeneries aaaa is not a match. This satisfies the minimum length of 3.
I typed 17 as, and they still match. Enter 19 a, which does not match.
should be 17 a, so it doesn"t match. Just false.

what"s going on with this? according to that expression, there doesn"t seem to be anything wrong, but it doesn"t work.

Apr.07,2021

because {n, m} means that the preceding characters are matched at least n times, and at most m times. So your regular expression matches at least 4 bits and up to 17 bits. So just change your regular expression to / ^ [a murz] [a-z1-9 -] {2jue 15} $/ and you can


/ ^ [a murz] [a-zA-Z0-9\ -] {2jue 15} $/

Menu