Skip to content

Instantly share code, notes, and snippets.

@waquwex
Created March 5, 2024 20:38
Show Gist options
  • Select an option

  • Save waquwex/6bbb919db24aebeff5afa9d03d6a9552 to your computer and use it in GitHub Desktop.

Select an option

Save waquwex/6bbb919db24aebeff5afa9d03d6a9552 to your computer and use it in GitHub Desktop.
Reasonable Regex patterns, Email, Username, Password
const EMAIL_REGEX_PATTERN = /^([a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})$/;
const USERNAME_REGEX_PATTERN = /^([A-Za-z\d._-]{5,})$/; // English letters + Numbers + . _ -
const PASSWORD_REGEX_PATTERN = /^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)(?=.*[._*-])[A-Za-z\d._*-]{8,}$/;
// Should contain at least one uppercase english letter, atl east one lowercase english letter,
// at least one number, at least one of . _ * -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment