Skip to content

Instantly share code, notes, and snippets.

@RyanABailey
Created November 24, 2014 05:27
Show Gist options
  • Save RyanABailey/97b261f8c4b5dda103bd to your computer and use it in GitHub Desktop.
Save RyanABailey/97b261f8c4b5dda103bd to your computer and use it in GitHub Desktop.
regex password
var password = "Mypassword01";
var regexString = "^((?=.{8,}$)(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*|(?=.{8,}$)(?=.*\d)(?=.*[a-zA-Z])(?=.*[!\u0022#$%&'()*+,./:;⇔?@[\]\^_`{|}~-]).*)";
var regexx = new RegExp(regexString);
if (!regexx.test(password)) {
// password did not match regex
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment