Skip to content

Instantly share code, notes, and snippets.

@codeasashu
Last active June 1, 2017 13:24
Show Gist options
  • Select an option

  • Save codeasashu/2e8af1e2b48c1f027297094926faed52 to your computer and use it in GitHub Desktop.

Select an option

Save codeasashu/2e8af1e2b48c1f027297094926faed52 to your computer and use it in GitHub Desktop.
Some regex collection
##Username regex
^[a-zA-Z0-9]+$
This only allows alphanumeric
##Password regex
^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,}$
This regex will enforce these rules:
At least one upper case english letter, (?=.*?[A-Z])
At least one lower case english letter, (?=.*?[a-z])
At least one digit, (?=.*?[0-9])
At least one special character, (?=.*?[#?!@$%^&*-])
Minimum 8 in length .{8,} (with the anchors)
##Address Regex
^\d+\s[A-z]+\s[A-z]+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment