Skip to content

Instantly share code, notes, and snippets.

@Kjaer
Created November 23, 2016 07:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kjaer/959193f73402b3ae7fa782cd08f823a0 to your computer and use it in GitHub Desktop.
Save Kjaer/959193f73402b3ae7fa782cd08f823a0 to your computer and use it in GitHub Desktop.
Password RuleSet
This is the javascript regular expression to check password meet the reqirements.
Here it is :
/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[$-/ | :-? | {-~ | ! | @ | # | " | ^ | _ |` | \[ | \]])[a-zA-Z0-9$-/:-?{-~!@#"^_`\[\]]{8,16}/g
(?=.*[a-z]) means should include lowercase letter
(?=.*[A-Z]) means should include uppercase letter
(?=.*[0-9]) means should include number
(?=.*[$-/ | :-? | {-~ | ! | @ | # | " | ^ | _ |` | \[ | \]]) means should include symbol
[a-zA-Z0-9$-/:-?{-~!@#"^_`\[\]] can accept these given charset class and chars.
Expression can be tested over there:
- http://www.regextester.com/?fam=96302
Happy coding.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment