Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js password validation regex

/^            : 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,}$/
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #js #password #validation #regex
ADD COMMENT
Topic
Name
7+6 =