Js password regular formula requirements must contain numbers and letters, in addition to spaces can have other special characters, 6-20 digits how to write! Thank you very much!

search for other information can not be found, I can not write it.

Mar.20,2021

check the following password errors, and if there is a matching result, it is considered not to conform to the composition specification of the password;

  1. No number exists;
  2. there are no letters;
  3. there are spaces;
  4. the number of digits is less than 6 digits
  5. more than 20 digits
^(.{0,5}|.{21,})$|^[^\d]*$|^[^a-zA-Z]*$|\s

it is better to teach people to fish than to teach people to fish
http://deerchao.net/tutorials.

/ (? = ^. {6 d) (20} $) (? =. *\ s). * $/


this problem can be found by any search engine.
look for it


now I have thought of the need for two regularities to judge

  1. must contain numbers and letters / (? =. * [\ d])? (? =. * [a-zA-Z]) (? =. * [\ d]) /
  2. spaces are not allowed / ^ (?!. * [\ s]) /

build environment

= update =

it is also possible to reverse upstairs

Menu