Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

password validation in javascript

/^            : Start
(?=.{8,})        : Length
(?=.*[a-zA-Z])   : Letters
(?=.*d)         : Digits
(?=.*[!#$%&?*^@"]) : Special characters
 $/              : End

 (/^
   (?=.*d)          //should contain at least one digit
  (?=.*[a-z])         //should contain at least one lower case
  (?=.*[A-Z])         //should contain at least one upper case
  [a-zA-Z0-9]{8,}  //should contain at least 8 from the mentioned characters
 $/)

Example:-   /^(?=.*d)(?=.*[a-zA-Z])[a-zA-Z0-9]{7,}$/
 
PREVIOUS NEXT
Tagged: #password #validation #javascript
ADD COMMENT
Topic
Name
7+3 =