Q . JavaScript Regex password validation(1 Special, 1 Integer);

Brad Johnson. asked, Sep 14 ' 2017

what will be the regex for password which contain special, alpha and integer characters.

  • regex
  • validation
  • password

1 Answers

I guess your regular expression should look like:

(/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])[0-9a-zA-Z]{8,}$/)

Here is an explanation:

(/^
(?=.*\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
$/)

Leave a Ansewer