Skip to content

Instantly share code, notes, and snippets.

@mezbahalam
Last active May 14, 2018 09:49
Show Gist options
  • Save mezbahalam/3fb8237274552025de6705196c8a1f99 to your computer and use it in GitHub Desktop.
Save mezbahalam/3fb8237274552025de6705196c8a1f99 to your computer and use it in GitHub Desktop.
rails strong password validator regex
validates :password,
length: { minimum: 10 },
format: { with: /\A(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[\W]).{10,}\z/,
message: "Must contain at least one uppercase letter, one special character, one number and one lowercase letter" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment