R
R
R02021-11-15 17:17:36
Regular Expressions
R0, 2021-11-15 17:17:36

Why return /^[A-Za-z0-9].{8,}/.test('Passw0rd'); returns false?

need to return false when
.test('')
has something other than [A-Za-z0-9] and if the string is less than 8 characters

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aetae, 2021-11-15
@Aetae

point is redundant.
Now you return false if the first character is not [А-Za-z0-9] or any characters after the first one is less than 8.
Learn the regexps. It's easy to learn how to write them, much easier than reading and / or trying to combine them.)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question